@cometchat/chat-sdk-javascript 4.0.14 → 4.1.0

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/CometChat.d.ts CHANGED
@@ -12,6 +12,27 @@
12
12
  export as namespace CometChatNotifications;
13
13
 
14
14
  export class CometChat {
15
+ static AIAssistantBaseEvent: typeof AIAssistantBaseEvent;
16
+ static AIAssistantRunStartedEvent: typeof AIAssistantRunStartedEvent;
17
+ static AIAssistantRunFinishedEvent: typeof AIAssistantRunFinishedEvent;
18
+ static AIAssistantMessageStartedEvent: typeof AIAssistantMessageStartedEvent;
19
+ static AIAssistantMessageEndedEvent: typeof AIAssistantMessageEndedEvent;
20
+ static AIAssistantContentReceivedEvent: typeof AIAssistantContentReceivedEvent;
21
+ static AIAssistantToolStartedEvent: typeof AIAssistantToolStartedEvent;
22
+ static AIAssistantToolEndedEvent: typeof AIAssistantToolEndedEvent;
23
+ static AIAssistantToolArgumentEvent: typeof AIAssistantToolArgumentEvent;
24
+ static AIAssistantToolResultEvent: typeof AIAssistantToolResultEvent;
25
+ static AI_ASSISTANT_EVENTS: {
26
+ RUN_STARTED: string;
27
+ RUN_FINISHED: string;
28
+ TEXT_MESSAGE_START: string;
29
+ TEXT_MESSAGE_END: string;
30
+ TEXT_MESSAGE_CONTENT: string;
31
+ TOOL_CALL_STARTED: string;
32
+ TOOL_CALL_ENDED: string;
33
+ TOOL_CALL_RESULT: string;
34
+ TOOL_CALL_ARGUMENT: string;
35
+ };
15
36
  static GroupType: typeof GroupType;
16
37
  static GroupMemberScope: typeof GroupMemberScope;
17
38
  static ResponseConstants: {
@@ -305,6 +326,9 @@ export class CometChat {
305
326
  AUDIO: string;
306
327
  FILE: string;
307
328
  CUSTOM: string;
329
+ ASSISTANT: string;
330
+ TOOL_RESULT: string;
331
+ TOOL_ARGUMENTS: string;
308
332
  };
309
333
  CATEGORY: {
310
334
  MESSAGE: string;
@@ -312,6 +336,7 @@ export class CometChat {
312
336
  CALL: string;
313
337
  CUSTOM: string;
314
338
  INTERACTIVE: string;
339
+ AGENTIC: string;
315
340
  };
316
341
  RECEIVER_TYPE: {
317
342
  USER: string;
@@ -348,6 +373,15 @@ export class CometChat {
348
373
  ELEMENT_ID: string;
349
374
  INTERACTED_AT: string;
350
375
  ELEMENT_IDS: string;
376
+ RUN_ID: string;
377
+ THREAD_ID: string;
378
+ TOOL_CALLS: string;
379
+ FUNCTION: string;
380
+ NAME: string;
381
+ ARGUMENTS: string;
382
+ TOOL_CALL_ID: string;
383
+ DISPLAY_NAME: string;
384
+ EXECUTION_TEXT: string;
351
385
  };
352
386
  KNOWN_MEDIA_TYPE: {
353
387
  IMAGE: any[];
@@ -398,6 +432,7 @@ export class CometChat {
398
432
  HAS_REACTIONS: string;
399
433
  MENTIONED_UIDS: string;
400
434
  ATTACHMENT_TYPES: string;
435
+ WITH_PARENT: string;
401
436
  };
402
437
  };
403
438
  };
@@ -996,6 +1031,14 @@ export class CometChat {
996
1031
  static Interaction: typeof Interaction;
997
1032
  static InteractionReceipt: typeof InteractionReceipt;
998
1033
  static MessageReceipt: typeof MessageReceipt;
1034
+ static AIAssistantMessage: typeof AIAssistantMessage;
1035
+ static AIToolCall: typeof AIToolCall;
1036
+ static AIToolCallFunction: typeof AIToolCallFunction;
1037
+ static AIAssistantMessageData: typeof AIAssistantMessageData;
1038
+ static AIToolResultMessage: typeof AIToolResultMessage;
1039
+ static AIToolResultMessageData: typeof AIToolResultMessageData;
1040
+ static AIToolArgumentMessage: typeof AIToolArgumentMessage;
1041
+ static AIToolArgumentMessageData: typeof AIToolArgumentMessageData;
999
1042
  static Group: typeof Group;
1000
1043
  static User: typeof User;
1001
1044
  static GroupMember: typeof GroupMember;
@@ -1037,6 +1080,7 @@ export class CometChat {
1037
1080
  static CallListener: typeof CallListener;
1038
1081
  static ConnectionListener: typeof ConnectionListener;
1039
1082
  static LoginListener: typeof LoginListener;
1083
+ static AIAssistantListener: typeof AIAssistantListener;
1040
1084
  static CallController: typeof CallController;
1041
1085
  static CometChatHelper: typeof CometChatHelper;
1042
1086
  static Attachment: typeof Attachment;
@@ -1049,6 +1093,9 @@ export class CometChat {
1049
1093
  AUDIO: string;
1050
1094
  FILE: string;
1051
1095
  CUSTOM: string;
1096
+ ASSISTANT: string;
1097
+ TOOL_RESULT: string;
1098
+ TOOL_ARGUMENTS: string;
1052
1099
  };
1053
1100
  static CATEGORY_MESSAGE: string;
1054
1101
  static CATEGORY_ACTION: string;
@@ -1768,6 +1815,21 @@ export class CometChat {
1768
1815
  * @memberof CometChat
1769
1816
  */
1770
1817
  static removeCallListener(name: string): void;
1818
+ /**
1819
+ *
1820
+ * Function to add an AI Assistant Listener.
1821
+ * @param {string} name
1822
+ * @param {AIAssistantListener} aiAssistantListener
1823
+ * @memberof CometChat
1824
+ */
1825
+ static addAIAssistantListener(name: string, aiAssistantListener: AIAssistantListener): void;
1826
+ /**
1827
+ *
1828
+ * Function to remove an AI Assistant Listener.
1829
+ * @param {string} name
1830
+ * @memberof CometChat
1831
+ */
1832
+ static removeAIAssistantListener(name: string): void;
1771
1833
  /**
1772
1834
  *
1773
1835
  * Function to add a User Listener.
@@ -2312,6 +2374,9 @@ export class MediaMessage extends BaseMessage implements Message {
2312
2374
  AUDIO: string;
2313
2375
  FILE: string;
2314
2376
  CUSTOM: string;
2377
+ ASSISTANT: string;
2378
+ TOOL_RESULT: string;
2379
+ TOOL_ARGUMENTS: string;
2315
2380
  };
2316
2381
  /** @private */ static readonly RECEIVER_TYPE: {
2317
2382
  USER: string;
@@ -2323,6 +2388,7 @@ export class MediaMessage extends BaseMessage implements Message {
2323
2388
  CALL: string;
2324
2389
  CUSTOM: string;
2325
2390
  INTERACTIVE: string;
2391
+ AGENTIC: string;
2326
2392
  };
2327
2393
  private url;
2328
2394
  private file;
@@ -2962,6 +3028,9 @@ export const MessageConstatnts: {
2962
3028
  AUDIO: string;
2963
3029
  FILE: string;
2964
3030
  CUSTOM: string;
3031
+ ASSISTANT: string;
3032
+ TOOL_RESULT: string;
3033
+ TOOL_ARGUMENTS: string;
2965
3034
  };
2966
3035
  CATEGORY: {
2967
3036
  MESSAGE: string;
@@ -2969,6 +3038,7 @@ export const MessageConstatnts: {
2969
3038
  CALL: string;
2970
3039
  CUSTOM: string;
2971
3040
  INTERACTIVE: string;
3041
+ AGENTIC: string;
2972
3042
  };
2973
3043
  RECEIVER_TYPE: {
2974
3044
  USER: string;
@@ -3005,6 +3075,15 @@ export const MessageConstatnts: {
3005
3075
  ELEMENT_ID: string;
3006
3076
  INTERACTED_AT: string;
3007
3077
  ELEMENT_IDS: string;
3078
+ RUN_ID: string;
3079
+ THREAD_ID: string;
3080
+ TOOL_CALLS: string;
3081
+ FUNCTION: string;
3082
+ NAME: string;
3083
+ ARGUMENTS: string;
3084
+ TOOL_CALL_ID: string;
3085
+ DISPLAY_NAME: string;
3086
+ EXECUTION_TEXT: string;
3008
3087
  };
3009
3088
  KNOWN_MEDIA_TYPE: {
3010
3089
  IMAGE: any[];
@@ -3055,6 +3134,7 @@ export const MessageConstatnts: {
3055
3134
  HAS_REACTIONS: string;
3056
3135
  MENTIONED_UIDS: string;
3057
3136
  ATTACHMENT_TYPES: string;
3137
+ WITH_PARENT: string;
3058
3138
  };
3059
3139
  };
3060
3140
  };
@@ -3072,7 +3152,8 @@ export enum MessageCategory {
3072
3152
  MESSAGE = "message",
3073
3153
  CALL = "call",
3074
3154
  CUSTOM = "custom",
3075
- INTERACTIVE = "interactive"
3155
+ INTERACTIVE = "interactive",
3156
+ AGENTIC = "agentic"
3076
3157
  }
3077
3158
  export enum GoalType {
3078
3159
  ANY_ACTION = "anyAction",
@@ -3856,6 +3937,17 @@ export enum AttachmentType {
3856
3937
  AUDIO = "audio",
3857
3938
  FILE = "file"
3858
3939
  }
3940
+ export const AI_ASSISTANT_EVENTS: {
3941
+ RUN_STARTED: string;
3942
+ RUN_FINISHED: string;
3943
+ TEXT_MESSAGE_START: string;
3944
+ TEXT_MESSAGE_END: string;
3945
+ TEXT_MESSAGE_CONTENT: string;
3946
+ TOOL_CALL_STARTED: string;
3947
+ TOOL_CALL_ENDED: string;
3948
+ TOOL_CALL_RESULT: string;
3949
+ TOOL_CALL_ARGUMENT: string;
3950
+ };
3859
3951
 
3860
3952
  /**
3861
3953
  *
@@ -4119,174 +4211,194 @@ export class MessageListener {
4119
4211
  * This event is triggered when a message is read by all members in a group.
4120
4212
  */
4121
4213
  onMessagesReadByAll?: Function;
4214
+ /**
4215
+ * This event is triggered when an AI tool result is received.
4216
+ */
4217
+ onAIToolResultReceived?: Function;
4218
+ /**
4219
+ * This event is triggered when an AI tool argument is received.
4220
+ */
4221
+ onAIToolArgumentsReceived?: Function;
4222
+ /**
4223
+ * This event is triggered when an AI assistant message is received.
4224
+ */
4225
+ onAIAssistantMessageReceived?: Function;
4122
4226
  constructor(...args: any[]);
4123
4227
  }
4124
4228
  export class CallListener {
4125
4229
  /**
4126
4230
  * This event is triggered when an incoming call is received.
4127
- */
4231
+ */
4128
4232
  onIncomingCallReceived?: Function;
4129
4233
  /**
4130
4234
  * This event is triggered when an outgoing call is accepted.
4131
- */
4235
+ */
4132
4236
  onOutgoingCallAccepted?: Function;
4133
4237
  /**
4134
4238
  * This event is triggered when an outgoing call is rejected.
4135
- */
4239
+ */
4136
4240
  onOutgoingCallRejected?: Function;
4137
4241
  /**
4138
4242
  * This event is triggered when an incoming call is cancelled.
4139
- */
4243
+ */
4140
4244
  onIncomingCallCancelled?: Function;
4141
4245
  /**
4142
4246
  * This event is triggered when call is ended.
4143
- */
4247
+ */
4144
4248
  onCallEndedMessageReceived?: Function;
4145
4249
  constructor(...args: any[]);
4146
4250
  }
4251
+ export class AIAssistantListener {
4252
+ /**
4253
+ * This event is triggered when an AI assistant event is received.
4254
+ * @param event - The AI assistant event that was received
4255
+ */
4256
+ onAIAssistantEventReceived?: (event: AIAssistantBaseEvent) => void;
4257
+ constructor(...args: any[]);
4258
+ }
4147
4259
  export class UserListener {
4148
4260
  /**
4149
4261
  * This event is triggered when a user comes online.
4150
- */
4262
+ */
4151
4263
  onUserOnline?: Function;
4152
4264
  /**
4153
4265
  * This event is triggered when a user goes offline.
4154
- */
4266
+ */
4155
4267
  onUserOffline?: Function;
4156
4268
  constructor(...args: any[]);
4157
4269
  }
4158
4270
  export class GroupListener {
4159
4271
  /**
4160
4272
  * This event is triggered when a user joins a group.
4161
- */
4273
+ */
4162
4274
  onGroupMemberJoined?: Function;
4163
4275
  /**
4164
4276
  * This event is triggered when a group member leaves the group.
4165
- */
4277
+ */
4166
4278
  onGroupMemberLeft?: Function;
4167
4279
  /**
4168
4280
  * This event is triggered when a group member is kicked from the group.
4169
- */
4281
+ */
4170
4282
  onGroupMemberKicked?: Function;
4171
4283
  /**
4172
4284
  * This event is triggered when a group member is banned from the group.
4173
- */
4285
+ */
4174
4286
  onGroupMemberBanned?: Function;
4175
4287
  /**
4176
4288
  * This event is triggered when a group member is unbanned from the group.
4177
- */
4289
+ */
4178
4290
  onGroupMemberUnbanned?: Function;
4179
4291
  /**
4180
4292
  * This event is triggered when scope of a group member is changed.
4181
- */
4293
+ */
4182
4294
  onGroupMemberScopeChanged?: Function;
4183
4295
  /**
4184
4296
  * This event is triggered when a user is added in the group.
4185
- */
4297
+ */
4186
4298
  onGroupMemberAddedToGroup: Function;
4187
4299
  constructor(...args: any[]);
4188
4300
  }
4189
4301
  export class OngoingCallListener {
4190
4302
  /**
4191
4303
  * @internal
4192
- */
4304
+ */
4193
4305
  onYouLeft?: Function;
4194
4306
  /**
4195
4307
  * @internal
4196
- */
4308
+ */
4197
4309
  onYouJoined?: Function;
4198
4310
  /**
4199
4311
  * This event is triggered when a user joins the call.
4200
- */
4312
+ */
4201
4313
  onUserJoined?: Function;
4202
4314
  /**
4203
4315
  * This event is triggered when a user leaves the call.
4204
- */
4316
+ */
4205
4317
  onUserLeft?: Function;
4206
4318
  /**
4207
4319
  * This event is triggered when the participant list of the call changes.
4208
- */
4320
+ */
4209
4321
  onUserListUpdated?: Function;
4210
4322
  /**
4211
4323
  * This event is triggered when the media device list changes.
4212
- */
4324
+ */
4213
4325
  onMediaDeviceListUpdated?: Function;
4214
4326
  /**
4215
4327
  * This event is triggered when someone starts recording the call.
4216
- */
4328
+ */
4217
4329
  onRecordingStarted?: Function;
4218
4330
  /**
4219
4331
  * This event is triggered when someone stops recording the call.
4220
- */
4332
+ */
4221
4333
  onRecordingStopped?: Function;
4222
4334
  /**
4223
4335
  * This event is triggered when someone starts sharing their screen in the call.
4224
- */
4336
+ */
4225
4337
  onScreenShareStarted?: Function;
4226
4338
  /**
4227
4339
  * This event is triggered when someone stops sharing their screen in the call.
4228
- */
4340
+ */
4229
4341
  onScreenShareStopped?: Function;
4230
4342
  /**
4231
4343
  * This event is triggered when a user is muted.
4232
- */
4344
+ */
4233
4345
  onUserMuted?: Function;
4234
4346
  /**
4235
4347
  * This event is triggered when an audio call is switched to a video call.
4236
- */
4348
+ */
4237
4349
  onCallSwitchedToVideo?: Function;
4238
4350
  /**
4239
4351
  * This event is triggered when the call is ended.
4240
- */
4352
+ */
4241
4353
  onCallEnded?: Function;
4242
4354
  /**
4243
4355
  * This event is triggered when an error occurs.
4244
- */
4356
+ */
4245
4357
  onError?: Function;
4246
4358
  constructor(...args: any[]);
4247
4359
  }
4248
4360
  export class LoginListener {
4249
4361
  /**
4250
4362
  * This event is triggered when the user login is successful.
4251
- */
4363
+ */
4252
4364
  loginSuccess?: Function;
4253
4365
  /**
4254
4366
  * This event is triggered when the user login fails.
4255
- */
4367
+ */
4256
4368
  loginFailure?: Function;
4257
4369
  /**
4258
4370
  * This event is triggered when the user logout is successful.
4259
- */
4371
+ */
4260
4372
  logoutSuccess?: Function;
4261
4373
  /**
4262
4374
  * This event is triggered when the user logout fails.
4263
- */
4375
+ */
4264
4376
  logoutFailure?: Function;
4265
4377
  constructor(...args: any[]);
4266
4378
  }
4267
4379
  export class ConnectionListener {
4268
4380
  /**
4269
4381
  * This event is triggered when the WebSocket connection is in connected state.
4270
- */
4382
+ */
4271
4383
  onConnected?: Function;
4272
4384
  /**
4273
4385
  * This event is triggered when the WebSocket connection is in connecting state.
4274
- */
4386
+ */
4275
4387
  inConnecting?: Function;
4276
4388
  /**
4277
4389
  * This event is triggered when the WebSocket connection is in disconnected state.
4278
- */
4390
+ */
4279
4391
  onDisconnected?: Function;
4280
4392
  /**
4281
4393
  * This event is triggered when the WebSocket connection is in feature throttled state.
4282
- */
4394
+ */
4283
4395
  onFeatureThrottled?: Function;
4284
4396
  constructor(...args: any[]);
4285
4397
  }
4286
4398
  /** @internal */
4287
4399
  export interface EventListener {
4288
4400
  _name: string;
4289
- _eventListener?: MessageListener | UserListener | OngoingCallListener | CallListener | GroupListener | LoginListener | ConnectionListener;
4401
+ _eventListener?: MessageListener | UserListener | OngoingCallListener | CallListener | GroupListener | LoginListener | ConnectionListener | AIAssistantListener;
4290
4402
  }
4291
4403
  /** @internal */
4292
4404
  export class Listener implements EventListener {
@@ -4331,6 +4443,12 @@ export class UserLoginListener extends Listener implements EventListener {
4331
4443
  constructor(name: string, loginEventHandler?: LoginListener, cursor?: number, callback?: Function);
4332
4444
  }
4333
4445
  /** @internal */
4446
+ export class AssistantsListener extends Listener implements EventListener {
4447
+ _cursor?: number;
4448
+ _eventListener: AIAssistantListener;
4449
+ constructor(name: string, aiEventHandler?: AIAssistantListener, cursor?: number, callback?: Function);
4450
+ }
4451
+ /** @internal */
4334
4452
  export class WSConnectionListener extends Listener implements EventListener {
4335
4453
  _cursor?: number;
4336
4454
  _eventListener: ConnectionListener;
@@ -4350,6 +4468,9 @@ export class Call extends BaseMessage implements Message {
4350
4468
  AUDIO: string;
4351
4469
  FILE: string;
4352
4470
  CUSTOM: string;
4471
+ ASSISTANT: string;
4472
+ TOOL_RESULT: string;
4473
+ TOOL_ARGUMENTS: string;
4353
4474
  };
4354
4475
  static readonly RECEIVER_TYPE: {
4355
4476
  USER: string;
@@ -4361,6 +4482,7 @@ export class Call extends BaseMessage implements Message {
4361
4482
  CALL: string;
4362
4483
  CUSTOM: string;
4363
4484
  INTERACTIVE: string;
4485
+ AGENTIC: string;
4364
4486
  };
4365
4487
  static readonly ACTION_TYPE: {
4366
4488
  TYPE_MEMBER_JOINED: string;
@@ -4642,6 +4764,9 @@ export class Action extends BaseMessage implements Message {
4642
4764
  AUDIO: string;
4643
4765
  FILE: string;
4644
4766
  CUSTOM: string;
4767
+ ASSISTANT: string;
4768
+ TOOL_RESULT: string;
4769
+ TOOL_ARGUMENTS: string;
4645
4770
  };
4646
4771
  static readonly RECEIVER_TYPE: {
4647
4772
  USER: string;
@@ -4653,6 +4778,7 @@ export class Action extends BaseMessage implements Message {
4653
4778
  CALL: string;
4654
4779
  CUSTOM: string;
4655
4780
  INTERACTIVE: string;
4781
+ AGENTIC: string;
4656
4782
  };
4657
4783
  static readonly ACTION_TYPE: {
4658
4784
  TYPE_MEMBER_JOINED: string;
@@ -5582,6 +5708,10 @@ export class MessagesRequest {
5582
5708
  * @return {Array<AttachmentTypes>}
5583
5709
  */
5584
5710
  getAttachmentTypes(): Array<AttachmentType>;
5711
+ /**
5712
+ * Gets the flag indicating whether to fetch messages with parent message information.
5713
+ */
5714
+ isWithParent(): boolean;
5585
5715
  /**
5586
5716
  * Get list of next messages based on the parameters specified in MessagesRequestBuilder class. The Developer need to call this method repeatedly using the same object of MessagesRequest class to get paginated list of message.
5587
5717
  * @returns {Promise<BaseMessage[] | []>}
@@ -5623,6 +5753,7 @@ export class MessagesRequestBuilder {
5623
5753
  /** @private */ HasReactions?: boolean;
5624
5754
  /** @private */ mentionedUIDs?: Array<String>;
5625
5755
  /** @private */ attachmentTypes?: Array<AttachmentType>;
5756
+ /** @private */ WithParent?: boolean;
5626
5757
  /**
5627
5758
  * A method to set limit for the number of messages returned in a single iteration. A maximum of 100 messages can fetched in a single iteration.
5628
5759
  * @param {number} limit
@@ -5791,6 +5922,12 @@ export class MessagesRequestBuilder {
5791
5922
  * @returns
5792
5923
  */
5793
5924
  setAttachmentTypes(attachmentTypes: Array<AttachmentType>): this;
5925
+ /**
5926
+ * This method will set the flag indicating whether to fetch messages with parent message information.
5927
+ * @param {boolean} withParent
5928
+ * @returns {this}
5929
+ */
5930
+ withParent(withParent?: boolean): this;
5794
5931
  /**
5795
5932
  * This method will return an object of the MessagesRequest class.
5796
5933
  * @returns {MessagesRequest}
@@ -6883,6 +7020,9 @@ export class InteractiveMessage extends BaseMessage implements Message {
6883
7020
  AUDIO: string;
6884
7021
  FILE: string;
6885
7022
  CUSTOM: string;
7023
+ ASSISTANT: string;
7024
+ TOOL_RESULT: string;
7025
+ TOOL_ARGUMENTS: string;
6886
7026
  };
6887
7027
  /** @private */ static readonly RECEIVER_TYPE: {
6888
7028
  USER: string;
@@ -6894,6 +7034,7 @@ export class InteractiveMessage extends BaseMessage implements Message {
6894
7034
  CALL: string;
6895
7035
  CUSTOM: string;
6896
7036
  INTERACTIVE: string;
7037
+ AGENTIC: string;
6897
7038
  };
6898
7039
  private interactiveData;
6899
7040
  private interactionGoal;
@@ -7311,6 +7452,325 @@ export class MessageReceipt {
7311
7452
  setReceiptType(receiptType?: string): void;
7312
7453
  }
7313
7454
 
7455
+ /**
7456
+ *
7457
+ * @module AIAssistantMessage
7458
+ */
7459
+ export class AIAssistantMessageData {
7460
+ runId: string;
7461
+ threadId: string;
7462
+ text: string;
7463
+ constructor(runId: string, threadId: string, text: string);
7464
+ getRunId(): string;
7465
+ setRunId(runId: string): void;
7466
+ getThreadId(): string;
7467
+ setThreadId(threadId: string): void;
7468
+ getText(): string;
7469
+ setText(text: string): void;
7470
+ }
7471
+ export class AIAssistantMessage extends BaseMessage implements Message {
7472
+ protected data?: any;
7473
+ protected aiAssistantMessageData?: AIAssistantMessageData;
7474
+ constructor(receiverId: string, receiverType: string);
7475
+ /**
7476
+ * Method to get sender of the message.
7477
+ * @returns {User}
7478
+ */
7479
+ getSender(): User;
7480
+ /**
7481
+ * Method to get receiver of the message.
7482
+ * @returns {User | Group}
7483
+ */
7484
+ getReceiver(): User | Group;
7485
+ /**
7486
+ * Method to get data of the message.
7487
+ * @returns {AIAssistantMessageData}
7488
+ */
7489
+ getAssistantMessageData(): AIAssistantMessageData;
7490
+ /**
7491
+ * Method to set data of the message.
7492
+ * @param {AIAssistantMessageData} data
7493
+ */
7494
+ setAssistantMessageData(data: AIAssistantMessageData): void;
7495
+ /**
7496
+ * Method to get data of the message.
7497
+ * @returns {Object}
7498
+ */
7499
+ getData(): any;
7500
+ /**
7501
+ * Get the tags of the message.
7502
+ * @returns {Array<String>}
7503
+ */
7504
+ getTags(): Array<String>;
7505
+ /**
7506
+ * @param {Array<String>} tags
7507
+ * Set the tags for the message.
7508
+ */
7509
+ setTags(tags: Array<String>): void;
7510
+ }
7511
+
7512
+ /**
7513
+ *
7514
+ * @module AIToolResultMessage
7515
+ */
7516
+ export class AIToolResultMessageData {
7517
+ runId: string;
7518
+ threadId: string;
7519
+ text: string;
7520
+ toolCallId: string;
7521
+ constructor(runId: string, threadId: string, text: string, toolCallId: string);
7522
+ /**
7523
+ * Get the run ID of the tool result message.
7524
+ * @returns {string}
7525
+ */
7526
+ getRunId(): string;
7527
+ /**
7528
+ * Set the run ID of the tool result message.
7529
+ * @param {string} runId
7530
+ */
7531
+ setRunId(runId: string): void;
7532
+ /**
7533
+ * Get the thread ID of the tool result message.
7534
+ * @returns {string}
7535
+ */
7536
+ getThreadId(): string;
7537
+ /**
7538
+ * Set the thread ID of the tool result message.
7539
+ * @param {string} threadId
7540
+ */
7541
+ setThreadId(threadId: string): void;
7542
+ /**
7543
+ * Get the text of the tool result message.
7544
+ * @returns {string}
7545
+ */
7546
+ getText(): string;
7547
+ /**
7548
+ * Set the text of the tool result message.
7549
+ * @param {string} text
7550
+ */
7551
+ setText(text: string): void;
7552
+ /**
7553
+ * Get the tool call ID of the tool result message.
7554
+ * @returns {string}
7555
+ */
7556
+ getToolCallId(): string;
7557
+ /**
7558
+ * Set the tool call ID of the tool result message.
7559
+ * @param {string} toolCallId
7560
+ */
7561
+ setToolCallId(toolCallId: string): void;
7562
+ }
7563
+ export class AIToolResultMessage extends BaseMessage implements Message {
7564
+ protected data?: any;
7565
+ protected toolMessageData?: AIToolResultMessageData;
7566
+ constructor(receiverId: string, receiverType: string);
7567
+ /**
7568
+ * Method to get sender of the message.
7569
+ * @returns {User}
7570
+ */
7571
+ getSender(): User;
7572
+ /**
7573
+ * Method to get receiver of the message.
7574
+ * @returns {User | Group}
7575
+ */
7576
+ getReceiver(): User | Group;
7577
+ /**
7578
+ * Method to get data of the message.
7579
+ * @returns {AIToolResultMessageData}
7580
+ */
7581
+ getToolResultMessageData(): AIToolResultMessageData;
7582
+ /**
7583
+ * Method to set data of the message.
7584
+ * @param {AIAssistantMessageData} data
7585
+ */
7586
+ setToolResultMessageData(data: AIToolResultMessageData): void;
7587
+ /**
7588
+ * Method to get data of the message.
7589
+ * @returns {Object}
7590
+ */
7591
+ getData(): any;
7592
+ /**
7593
+ * Get the tags of the message.
7594
+ * @returns {Array<String>}
7595
+ */
7596
+ getTags(): Array<String>;
7597
+ /**
7598
+ * @param {Array<String>} tags
7599
+ * Set the tags for the message.
7600
+ */
7601
+ setTags(tags: Array<String>): void;
7602
+ }
7603
+
7604
+ /**
7605
+ *
7606
+ * @module AIToolArgumentMessage
7607
+ */
7608
+ export class AIToolCallFunction {
7609
+ name: string;
7610
+ arguments: string;
7611
+ constructor(name: string, args: string);
7612
+ /**
7613
+ * Get the name of the function.
7614
+ * @returns {string}
7615
+ */
7616
+ getName(): string;
7617
+ /**
7618
+ * Set the name of the function.
7619
+ * @param {string} name
7620
+ */
7621
+ setName(name: string): void;
7622
+ /**
7623
+ * Get the arguments of the function.
7624
+ * @returns {string}
7625
+ */
7626
+ getArguments(): string;
7627
+ /**
7628
+ * Set the arguments of the function.
7629
+ * @param {string} args
7630
+ */
7631
+ setArguments(args: string): void;
7632
+ }
7633
+ export class AIToolCall {
7634
+ id: string;
7635
+ type: string;
7636
+ displayName?: string;
7637
+ executionText?: string;
7638
+ function: AIToolCallFunction;
7639
+ constructor(id: string, type: string, functionObj: AIToolCallFunction, displayName?: string, executionText?: string);
7640
+ /**
7641
+ * Get the id of the tool call.
7642
+ * @returns {string}
7643
+ */
7644
+ getId(): string;
7645
+ /**
7646
+ * Set the id of the tool call.
7647
+ * @param {string} id
7648
+ */
7649
+ setId(id: string): void;
7650
+ /**
7651
+ * Get the type of the tool call.
7652
+ * @returns {string}
7653
+ */
7654
+ getType(): string;
7655
+ /**
7656
+ * Set the type of the tool call.
7657
+ * @param {string} type
7658
+ */
7659
+ setType(type: string): void;
7660
+ /**
7661
+ * Get the function associated with the tool call.
7662
+ * @returns {AIToolCallFunction}
7663
+ */
7664
+ getFunction(): AIToolCallFunction;
7665
+ /**
7666
+ * Set the function associated with the tool call.
7667
+ * @param {AIToolCallFunction} functionObj
7668
+ */
7669
+ setFunction(functionObj: AIToolCallFunction): void;
7670
+ /**
7671
+ * Get the display name of the tool call.
7672
+ * @returns {string | undefined}
7673
+ */
7674
+ getDisplayName(): string | undefined;
7675
+ /**
7676
+ * Set the display name of the tool call.
7677
+ * @param {string} displayName
7678
+ */
7679
+ setDisplayName(displayName: string): void;
7680
+ /**
7681
+ * Get the execution text of the tool call.
7682
+ * @returns {string | undefined}
7683
+ */
7684
+ getExecutionText(): string | undefined;
7685
+ /**
7686
+ * Set the execution text of the tool call.
7687
+ * @param {string} executionText
7688
+ */
7689
+ setExecutionText(executionText: string): void;
7690
+ /**
7691
+ * Convert the tool call to a JSON object.
7692
+ * @returns {Object}
7693
+ */
7694
+ static fromJSON(json: any): AIToolCall;
7695
+ static fromArray(array: Array<any>): Array<AIToolCall>;
7696
+ }
7697
+ export class AIToolArgumentMessageData {
7698
+ runId: string;
7699
+ threadId: string;
7700
+ toolCalls?: Array<AIToolCall>;
7701
+ constructor(runId: string, threadId: string, toolCalls?: Array<AIToolCall>);
7702
+ /**
7703
+ * Get the run ID of the tool argument message.
7704
+ * @returns {string}
7705
+ */
7706
+ getRunId(): string;
7707
+ /**
7708
+ * Set the run ID of the tool argument message.
7709
+ * @param {string} runId
7710
+ */
7711
+ setRunId(runId: string): void;
7712
+ /**
7713
+ * Get the thread ID of the tool argument message.
7714
+ * @returns {string}
7715
+ */
7716
+ getThreadId(): string;
7717
+ /**
7718
+ * Set the thread ID of the tool argument message.
7719
+ * @param {string} threadId
7720
+ */
7721
+ setThreadId(threadId: string): void;
7722
+ /**
7723
+ * Get the tool calls associated with the tool argument message.
7724
+ * @returns {Array<AIToolCall> | undefined}
7725
+ */
7726
+ getToolCalls(): Array<AIToolCall> | undefined;
7727
+ /**
7728
+ * Set the tool calls associated with the tool argument message.
7729
+ * @param {Array<AIToolCall>} toolCalls
7730
+ */
7731
+ setToolCalls(toolCalls: Array<AIToolCall>): void;
7732
+ }
7733
+ export class AIToolArgumentMessage extends BaseMessage implements Message {
7734
+ protected data?: any;
7735
+ protected aiToolArgumentMessageData?: AIToolArgumentMessageData;
7736
+ constructor(receiverId: string, receiverType: string);
7737
+ /**
7738
+ * Method to get sender of the message.
7739
+ * @returns {User}
7740
+ */
7741
+ getSender(): User;
7742
+ /**
7743
+ * Method to get receiver of the message.
7744
+ * @returns {User | Group}
7745
+ */
7746
+ getReceiver(): User | Group;
7747
+ /**
7748
+ * Method to get data of the message.
7749
+ * @returns {AIToolArgumentMessageData}
7750
+ */
7751
+ getToolArgumentMessageData(): AIToolArgumentMessageData;
7752
+ /**
7753
+ * Method to set data of the message.
7754
+ * @param {AIToolArgumentMessageData} data
7755
+ */
7756
+ setToolArgumentMessageData(data: AIToolArgumentMessageData): void;
7757
+ /**
7758
+ * Method to get data of the message.
7759
+ * @returns {Object}
7760
+ */
7761
+ getData(): any;
7762
+ /**
7763
+ * Get the tags of the message.
7764
+ * @returns {Array<String>}
7765
+ */
7766
+ getTags(): Array<String>;
7767
+ /**
7768
+ * @param {Array<String>} tags
7769
+ * Set the tags for the message.
7770
+ */
7771
+ setTags(tags: Array<String>): void;
7772
+ }
7773
+
7314
7774
  /** Push Notification Preferences Enums */
7315
7775
  export enum MessagesOptions {
7316
7776
  DONT_SUBSCRIBE,
@@ -7810,3 +8270,391 @@ export class RTCUser {
7810
8270
  setResource(resource: string): void;
7811
8271
  getResource(): string;
7812
8272
  }
8273
+
8274
+ /**
8275
+ * Base interface for all assistant event data
8276
+ * @internal
8277
+ */
8278
+ export interface AssistantBaseEventData {
8279
+ timestamp: number;
8280
+ runId: string;
8281
+ threadId: string;
8282
+ [key: string]: any;
8283
+ }
8284
+ /**
8285
+ * Base class for stream events in CometChat SDK
8286
+ */
8287
+ export class AIAssistantBaseEvent<T extends AssistantBaseEventData = AssistantBaseEventData> {
8288
+ /**
8289
+ * The type of the stream event
8290
+ */
8291
+ type: string;
8292
+ /**
8293
+ * The conversation ID associated with the event
8294
+ */
8295
+ conversationId: string;
8296
+ /**
8297
+ * The message ID associated with the event
8298
+ */
8299
+ messageId: string;
8300
+ /**
8301
+ * The parent message ID (if applicable)
8302
+ */
8303
+ patentMessageId: string;
8304
+ /**
8305
+ * Additional data associated with the event
8306
+ */
8307
+ data: T;
8308
+ /**
8309
+ * Constructor for BaseStreamEvent
8310
+ * @param type - The type of the stream event
8311
+ * @param conversationId - The conversation ID
8312
+ * @param messageId - The message ID
8313
+ * @param patentMessageId - The parent message ID
8314
+ * @param data - Additional data with timestamp
8315
+ */
8316
+ constructor(type: string, conversationId: string, messageId: string, patentMessageId: string, data: T);
8317
+ /**
8318
+ * Get the type of the stream event
8319
+ * @returns The type as a string
8320
+ */
8321
+ getType(): string;
8322
+ /**
8323
+ * Set the type of the stream event
8324
+ * @param type - The type to set
8325
+ */
8326
+ setType(type: string): void;
8327
+ /**
8328
+ * Get the conversation ID
8329
+ * @returns The conversation ID as a string
8330
+ */
8331
+ getConversationId(): string;
8332
+ /**
8333
+ * Set the conversation ID
8334
+ * @param conversationId - The conversation ID to set
8335
+ */
8336
+ setConversationId(conversationId: string): void;
8337
+ /**
8338
+ * Get the message ID
8339
+ * @returns The message ID as a string
8340
+ */
8341
+ getMessageId(): string;
8342
+ /**
8343
+ * Set the message ID
8344
+ * @param messageId - The message ID to set
8345
+ */
8346
+ setMessageId(messageId: string): void;
8347
+ /**
8348
+ * Get the parent message ID
8349
+ * @returns The parent message ID as a string
8350
+ */
8351
+ getPatentMessageId(): string;
8352
+ /**
8353
+ * Set the parent message ID
8354
+ * @param patentMessageId - The parent message ID to set
8355
+ */
8356
+ setPatentMessageId(patentMessageId: string): void;
8357
+ /**
8358
+ * Get the data object
8359
+ * @returns The data object
8360
+ */
8361
+ getData(): T;
8362
+ /**
8363
+ * Set the data object
8364
+ * @param data - The data object to set
8365
+ */
8366
+ setData(data: T): void;
8367
+ /**
8368
+ * Get the timestamp from the data object
8369
+ * @returns The timestamp as a number
8370
+ */
8371
+ getTimestamp(): number;
8372
+ /**
8373
+ * Set the timestamp in the data object
8374
+ * @param timestamp - The timestamp to set
8375
+ */
8376
+ setTimestamp(timestamp: number): void;
8377
+ /**
8378
+ * Get the run ID from the data object
8379
+ * @returns The run ID as a string
8380
+ */
8381
+ getRunId(): string;
8382
+ /**
8383
+ * Set the run ID in the data object
8384
+ * @param runId - The run ID to set
8385
+ */
8386
+ setRunId(runId: string): void;
8387
+ /**
8388
+ * Get the thread ID from the data object
8389
+ * @returns The thread ID as a string
8390
+ */
8391
+ getThreadId(): string;
8392
+ /**
8393
+ * Set the thread ID in the data object
8394
+ * @param threadId - The thread ID to set
8395
+ */
8396
+ setThreadId(threadId: string): void;
8397
+ /**
8398
+ * Convert the event to a JSON object
8399
+ * @returns JSON representation of the event
8400
+ */
8401
+ toJSON(): object;
8402
+ /**
8403
+ * Create a BaseStreamEvent from a JSON object
8404
+ * @param json - The JSON object to create the event from
8405
+ * @returns A new BaseStreamEvent instance
8406
+ */
8407
+ static fromJSON(json: any): AIAssistantBaseEvent;
8408
+ }
8409
+
8410
+ /**
8411
+ * Data structure for run events (run_started, run_finished)
8412
+ * @internal
8413
+ */
8414
+ export interface AssistantRunStartedEventData extends AssistantBaseEventData {
8415
+ [key: string]: any;
8416
+ }
8417
+ export class AIAssistantRunStartedEvent extends AIAssistantBaseEvent<AssistantRunStartedEventData> {
8418
+ constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantRunStartedEventData);
8419
+ }
8420
+
8421
+ /**
8422
+ * Data structure for run events (run_started, run_finished)
8423
+ * @internal
8424
+ */
8425
+ export interface AssistantRunFinishedEventData extends AssistantBaseEventData {
8426
+ [key: string]: any;
8427
+ }
8428
+ export class AIAssistantRunFinishedEvent extends AIAssistantBaseEvent<AssistantRunFinishedEventData> {
8429
+ constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantRunFinishedEventData);
8430
+ }
8431
+
8432
+ /**
8433
+ * Data structure for message events (text_message_start, text_message_end)
8434
+ * @internal
8435
+ */
8436
+ export interface AssistantMessageStartedEventData extends AssistantBaseEventData {
8437
+ role: string;
8438
+ [key: string]: any;
8439
+ }
8440
+ export class AIAssistantMessageStartedEvent extends AIAssistantBaseEvent<AssistantMessageStartedEventData> {
8441
+ constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantMessageStartedEventData);
8442
+ /**
8443
+ * Returns the role of the event
8444
+ * @returns {string | undefined} The role of the event
8445
+ */
8446
+ getRole(): string | undefined;
8447
+ /**
8448
+ * Sets the role of the event
8449
+ * @param {string} role - The role to set
8450
+ */
8451
+ setRole(role: string): void;
8452
+ }
8453
+
8454
+ /**
8455
+ * Data structure for message events (text_message_start, text_message_end)
8456
+ * @internal
8457
+ */
8458
+ export interface AssistantMessageEndedEventData extends AssistantBaseEventData {
8459
+ [key: string]: any;
8460
+ }
8461
+ export class AIAssistantMessageEndedEvent extends AIAssistantBaseEvent<AssistantMessageEndedEventData> {
8462
+ constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantMessageEndedEventData);
8463
+ }
8464
+
8465
+ /**
8466
+ * Data structure for content events (text_message_content)
8467
+ * @internal
8468
+ */
8469
+ export interface AssistantContentEventData extends AssistantBaseEventData {
8470
+ delta: string;
8471
+ [key: string]: any;
8472
+ }
8473
+ /**
8474
+ * Event class for text message content received from assistant
8475
+ */
8476
+ export class AIAssistantContentReceivedEvent extends AIAssistantBaseEvent<AssistantContentEventData> {
8477
+ constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantContentEventData);
8478
+ /**
8479
+ * Gets the delta value for the content received event
8480
+ * @returns The delta string
8481
+ */
8482
+ getDelta(): string;
8483
+ /**
8484
+ * Sets the delta value for the content received event
8485
+ * @param delta - The delta string to set
8486
+ */
8487
+ setDelta(delta: string): void;
8488
+ }
8489
+
8490
+ /**
8491
+ * Data structure for tool call started events
8492
+ * @internal
8493
+ */
8494
+ export interface AssistantToolStartedEventData extends AssistantBaseEventData {
8495
+ toolCallId: string;
8496
+ toolCallName: string;
8497
+ displayName: string;
8498
+ executionText: string;
8499
+ [key: string]: any;
8500
+ }
8501
+ /**
8502
+ * Event class for tool call started events
8503
+ */
8504
+ export class AIAssistantToolStartedEvent extends AIAssistantBaseEvent<AssistantToolStartedEventData> {
8505
+ constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantToolStartedEventData);
8506
+ /**
8507
+ * Gets the tool call ID for the tool started event
8508
+ * @returns The tool call ID
8509
+ */
8510
+ getToolCallId(): string;
8511
+ /**
8512
+ * Sets the tool call ID for the tool started event
8513
+ * @param toolCallId - The tool call ID to set
8514
+ */
8515
+ setToolCallId(toolCallId: string): void;
8516
+ /**
8517
+ * Gets the tool call name for the tool started event
8518
+ * @returns The tool call name
8519
+ */
8520
+ getToolCallName(): string;
8521
+ /**
8522
+ * Sets the tool call name for the tool started event
8523
+ * @param toolCallName - The tool call name to set
8524
+ */
8525
+ setToolCallName(toolCallName: string): void;
8526
+ /**
8527
+ * Gets the display name for the tool started event
8528
+ * @returns The display name
8529
+ */
8530
+ getDisplayName(): string;
8531
+ /**
8532
+ * Sets the display name for the tool started event
8533
+ * @param displayName - The display name to set
8534
+ */
8535
+ setDisplayName(displayName: string): void;
8536
+ /**
8537
+ * Gets the execution text for the tool started event
8538
+ * @returns The execution text
8539
+ */
8540
+ getExecutionText(): string;
8541
+ /**
8542
+ * Sets the execution text for the tool started event
8543
+ * @param executionText - The execution text to set
8544
+ */
8545
+ setExecutionText(executionText: string): void;
8546
+ }
8547
+
8548
+ /**
8549
+ * Data structure for tool call argument events
8550
+ * @internal
8551
+ */
8552
+ export interface AssistantToolArgumentEventData extends AssistantBaseEventData {
8553
+ toolCallId: string;
8554
+ delta: string;
8555
+ [key: string]: any;
8556
+ }
8557
+ /**
8558
+ * Event class for tool call argument events
8559
+ */
8560
+ export class AIAssistantToolArgumentEvent extends AIAssistantBaseEvent<AssistantToolArgumentEventData> {
8561
+ constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantToolArgumentEventData);
8562
+ /**
8563
+ * Gets the tool call ID for the tool argument event
8564
+ * @returns The tool call ID
8565
+ */
8566
+ getToolCallId(): string;
8567
+ /**
8568
+ * Sets the tool call ID for the tool argument event
8569
+ * @param toolCallId - The tool call ID to set
8570
+ */
8571
+ setToolCallId(toolCallId: string): void;
8572
+ /**
8573
+ * Gets the delta value for the tool argument event
8574
+ * @returns The delta string
8575
+ */
8576
+ getDelta(): string;
8577
+ /**
8578
+ * Sets the delta value for the tool argument event
8579
+ * @param delta - The delta string to set
8580
+ */
8581
+ setDelta(delta: string): void;
8582
+ }
8583
+
8584
+ /**
8585
+ * Data structure for tool call ended events
8586
+ * @internal
8587
+ */
8588
+ export interface AssistantToolEndedEventData extends AssistantBaseEventData {
8589
+ toolCallId: string;
8590
+ [key: string]: any;
8591
+ }
8592
+ /**
8593
+ * Event class for tool call ended events
8594
+ */
8595
+ export class AIAssistantToolEndedEvent extends AIAssistantBaseEvent<AssistantToolEndedEventData> {
8596
+ constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantToolEndedEventData);
8597
+ /**
8598
+ * Gets the tool call ID for the tool ended event
8599
+ * @returns The tool call ID
8600
+ */
8601
+ getToolCallId(): string;
8602
+ /**
8603
+ * Sets the tool call ID for the tool ended event
8604
+ * @param toolCallId - The tool call ID to set
8605
+ */
8606
+ setToolCallId(toolCallId: string): void;
8607
+ /**
8608
+ * Converts the event to a JSON representation
8609
+ * @returns The JSON representation of the event
8610
+ */
8611
+ static fromJSON(json: any): AIAssistantToolEndedEvent;
8612
+ }
8613
+
8614
+ /**
8615
+ * Data structure for tool call result events
8616
+ * @internal
8617
+ */
8618
+ export interface AssistantToolResultEventData extends AssistantBaseEventData {
8619
+ toolCallId: string;
8620
+ content: string;
8621
+ role: string;
8622
+ [key: string]: any;
8623
+ }
8624
+ /**
8625
+ * Event class for tool call result events
8626
+ */
8627
+ export class AIAssistantToolResultEvent extends AIAssistantBaseEvent<AssistantToolResultEventData> {
8628
+ constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantToolResultEventData);
8629
+ /**
8630
+ * Gets the tool call ID for the tool result event
8631
+ * @returns The tool call ID
8632
+ */
8633
+ getToolCallId(): string;
8634
+ /**
8635
+ * Sets the tool call ID for the tool result event
8636
+ * @param toolCallId - The tool call ID to set
8637
+ */
8638
+ setToolCallId(toolCallId: string): void;
8639
+ /**
8640
+ * Gets the content of the tool result event
8641
+ * @returns The content string
8642
+ */
8643
+ getContent(): string;
8644
+ /**
8645
+ * Sets the content of the tool result event
8646
+ * @param content - The content string to set
8647
+ */
8648
+ setContent(content: string): void;
8649
+ /**
8650
+ * Returns the role of the event
8651
+ * @returns {string | undefined} The role of the event
8652
+ */
8653
+ getRole(): string;
8654
+ /**
8655
+ * Sets the role of the event
8656
+ * @param {string} role - The role to set
8657
+ */
8658
+ setRole(role: string): void;
8659
+ }
8660
+