@elqnt/chat 3.0.3 → 3.3.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.
@@ -158,6 +158,12 @@ declare const ChatEventTypeStoppedTyping: ChatEventType;
158
158
  declare const ChatEventTypeRead: ChatEventType;
159
159
  declare const ChatEventTypeDelivered: ChatEventType;
160
160
  declare const ChatEventTypeReconnected: ChatEventType;
161
+ /**
162
+ * ChatEventTypeTransportReconnected is CLIENT-SYNTHETIC: emitted by the
163
+ * browser SSE transport when it re-establishes a dropped stream, so the
164
+ * app layer can re-sync chat state. Never sent by the server.
165
+ */
166
+ declare const ChatEventTypeTransportReconnected: ChatEventType;
161
167
  declare const ChatEventTypeError: ChatEventType;
162
168
  declare const ChatEventTypeWaiting: ChatEventType;
163
169
  declare const ChatEventTypeLoadChat: ChatEventType;
@@ -295,7 +301,7 @@ declare const ChatEventTypeAttachmentProcessingProgress: ChatEventType;
295
301
  declare const ChatEventTypeAttachmentProcessingComplete: ChatEventType;
296
302
  declare const ChatEventTypeAttachmentProcessingError: ChatEventType;
297
303
  declare const ChatEventTypeRetryAttachment: ChatEventType;
298
- type ChatEventTypeTS = "message" | "user_joined" | "user_left" | "typing" | "stopped_typing" | "read" | "delivered" | "reconnected" | "error" | "message_status_update" | "load_chat" | "load_chat_response" | "waiting" | "waiting_for_agent" | "human_agent_joined" | "end_chat" | "chat_ended" | "human_agent_left" | "observer_joined" | "observer_left" | "list_chats" | "chat_updated" | "chat_removed" | "sync_metadata" | "sync_metadata_response" | "sync_user_session" | "sync_user_session_response" | "agent_session_start" | "agent_session_end" | "agent_status_change" | "agent_activity_ping" | "agent_chat_assigned" | "agent_chat_completed" | "client_action" | "client_action_callback" | "show_csat_survey" | "csat_response" | "user_suggested_actions" | "user_suggested_action_selected" | "summary_update" | "agent_context_update" | "agent_execution_started" | "agent_execution_ended" | "load_agent_context" | "load_agent_context_response" | "plan_pending_approval" | "plan_approved" | "plan_rejected" | "plan_completed" | "step_started" | "step_completed" | "step_failed" | "new_chat" | "new_chat_created" | "block_user" | "ping" | "pong" | "create_room" | "room_created" | "join_room" | "leave_room" | "delete_room" | "room_deleted" | "update_room" | "room_updated" | "invite_user" | "user_invited" | "room_user_joined" | "room_user_left" | "user_removed" | "list_rooms" | "rooms_response" | "message_edited" | "message_deleted" | "message_reaction" | "message_reply" | "mention_user" | "message_edited_response" | "message_deleted_response" | "message_reaction_response" | "user_presence_start" | "user_presence_end" | "user_status_change" | "user_activity" | "user_presence_changed" | "user_activity_update" | "get_online_users" | "online_users" | "get_agents" | "get_agents_response" | "skill_activate" | "skill_deactivate" | "skills_changed" | "attachment_processing_started" | "attachment_processing_progress" | "attachment_processing_complete" | "attachment_processing_error" | "retry_attachment";
304
+ type ChatEventTypeTS = "message" | "user_joined" | "user_left" | "typing" | "stopped_typing" | "read" | "delivered" | "reconnected" | "transport_reconnected" | "error" | "message_status_update" | "load_chat" | "load_chat_response" | "waiting" | "waiting_for_agent" | "human_agent_joined" | "end_chat" | "chat_ended" | "human_agent_left" | "observer_joined" | "observer_left" | "list_chats" | "chat_updated" | "chat_removed" | "sync_metadata" | "sync_metadata_response" | "sync_user_session" | "sync_user_session_response" | "agent_session_start" | "agent_session_end" | "agent_status_change" | "agent_activity_ping" | "agent_chat_assigned" | "agent_chat_completed" | "client_action" | "client_action_callback" | "show_csat_survey" | "csat_response" | "user_suggested_actions" | "user_suggested_action_selected" | "summary_update" | "agent_context_update" | "agent_execution_started" | "agent_execution_ended" | "load_agent_context" | "load_agent_context_response" | "plan_pending_approval" | "plan_approved" | "plan_rejected" | "plan_completed" | "step_started" | "step_completed" | "step_failed" | "new_chat" | "new_chat_created" | "block_user" | "ping" | "pong" | "create_room" | "room_created" | "join_room" | "leave_room" | "delete_room" | "room_deleted" | "update_room" | "room_updated" | "invite_user" | "user_invited" | "room_user_joined" | "room_user_left" | "user_removed" | "list_rooms" | "rooms_response" | "message_edited" | "message_deleted" | "message_reaction" | "message_reply" | "mention_user" | "message_edited_response" | "message_deleted_response" | "message_reaction_response" | "user_presence_start" | "user_presence_end" | "user_status_change" | "user_activity" | "user_presence_changed" | "user_activity_update" | "get_online_users" | "online_users" | "get_agents" | "get_agents_response" | "skill_activate" | "skill_deactivate" | "skills_changed" | "attachment_processing_started" | "attachment_processing_progress" | "attachment_processing_complete" | "attachment_processing_error" | "retry_attachment";
299
305
  type MessageStatus = string;
300
306
  declare const MessageStatusSending: MessageStatus;
301
307
  declare const MessageStatusSent: MessageStatus;
@@ -443,6 +449,20 @@ interface ChatMessage {
443
449
  * LLM usage
444
450
  */
445
451
  llmUsage?: LLMUsage;
452
+ /**
453
+ * Error details for synthetic error messages (rendered in-chat when a
454
+ * turn fails; see ChatEventTypeError). Nil for normal messages.
455
+ */
456
+ error?: ChatMessageError;
457
+ }
458
+ /**
459
+ * ChatMessageError is the client-facing payload of a failed turn: a stable
460
+ * code (e.g. LLM_FAILURE, TURN_TIMEOUT) and whether resending the original
461
+ * user message is worth offering.
462
+ */
463
+ interface ChatMessageError {
464
+ code?: string;
465
+ retryable?: boolean;
446
466
  }
447
467
  interface ChatEvent {
448
468
  type: ChatEventTypeTS;
@@ -503,6 +523,18 @@ interface LLMConfig {
503
523
  SystemPrompt: string;
504
524
  Tools: LLMTool[];
505
525
  Memory?: LLMMemoryConfig;
526
+ /**
527
+ * PreferredLanguage, when non-empty, locks the assistant's reply
528
+ * language for this turn — overriding the per-message detection
529
+ * providers would otherwise run on messages[0]. Sourced from the
530
+ * user's stored profile so a user who speaks both Arabic and English
531
+ * gets the language they actually prefer instead of whichever one
532
+ * happened to dominate their first utterance (especially relevant
533
+ * for voice notes, where Whisper sometimes mislabels mixed speech).
534
+ * Use the human-readable form ("English", "Arabic", "French") that
535
+ * the providers prepend straight into "Speak only in <lang>.".
536
+ */
537
+ PreferredLanguage: string;
506
538
  }
507
539
  interface LLMMemoryConfig {
508
540
  MaxMessages: number;
@@ -533,6 +565,7 @@ interface LLMResponse {
533
565
  ToolCalls: ToolCall[];
534
566
  Usage?: LLMUsage;
535
567
  ResponseId: string;
568
+ Truncated: boolean;
536
569
  }
537
570
  interface LLMUsage {
538
571
  inputTokens: number;
@@ -836,6 +869,71 @@ interface GetAgentContextResponse {
836
869
  agentContext: any;
837
870
  metadata: ResponseMetadata;
838
871
  }
872
+ /**
873
+ * ListIdleChatsRequest asks for chats idle longer than IdleMinutes, optionally
874
+ * filtered to a single product (metadata.product). Product is only a filter —
875
+ * the chat service applies no policy of its own.
876
+ */
877
+ interface ListIdleChatsRequest {
878
+ idleMinutes: number;
879
+ product: string;
880
+ limit: number;
881
+ }
882
+ /**
883
+ * ListIdleChatsResponse returns the matching chats (full objects, so the caller
884
+ * can write analytics without a second round-trip).
885
+ */
886
+ interface ListIdleChatsResponse {
887
+ chats: Chat[];
888
+ metadata: ResponseMetadata;
889
+ }
890
+ /**
891
+ * CloseChatRequest targets a single chat by org + key (used by both
892
+ * close-and-delete and mark-closed).
893
+ */
894
+ interface CloseChatRequest {
895
+ orgId: string;
896
+ chatKey: string;
897
+ }
898
+ interface CloseChatResponse {
899
+ metadata: ResponseMetadata;
900
+ }
901
+ interface MemoryContact {
902
+ name: string;
903
+ role?: string;
904
+ notes?: string;
905
+ lastMentionedAt?: number;
906
+ }
907
+ interface MemoryNote {
908
+ text: string;
909
+ extractedAt?: number;
910
+ source?: string;
911
+ }
912
+ interface MemoryProfile {
913
+ preferredName?: string;
914
+ timezone?: string;
915
+ language?: string;
916
+ company?: string;
917
+ role?: string;
918
+ /**
919
+ * Mobile is the user's own WhatsApp/phone number (E.164, digits-only).
920
+ * Captured explicitly at onboarding / Memory edit (NOT auto-extracted) and
921
+ * rendered into the agent system prompt via renderUserProfile, so an agent
922
+ * can message the user on their own number (e.g. send_whatsapp_on_behalf).
923
+ */
924
+ mobile?: string;
925
+ /**
926
+ * Email is a denormalized copy of the admin user's email so the agent
927
+ * prompt carries it alongside mobile regardless of signup channel. The
928
+ * admin users table stays the identity source of truth — patching this
929
+ * field never changes the login email.
930
+ */
931
+ email?: string;
932
+ contacts?: MemoryContact[];
933
+ notes?: MemoryNote[];
934
+ version: number;
935
+ updatedAt: number;
936
+ }
839
937
  declare const QueueTypes: {
840
938
  readonly skill: {
841
939
  readonly value: "skill";
@@ -982,6 +1080,13 @@ declare const GetChatSubject = "chat.get_chat";
982
1080
  * Chat Archival Subjects
983
1081
  */
984
1082
  declare const ChatArchiveSubjectPattern = "chat.archive.%s.server";
1083
+ /**
1084
+ * Chat Maintenance Subjects (generic, product-agnostic; product backends
1085
+ * call these to drive their own retention/lifecycle policy).
1086
+ */
1087
+ declare const ListIdleChatsSubject = "chat.maintenance.list_idle_chats";
1088
+ declare const CloseAndDeleteChatSubject = "chat.maintenance.close_and_delete_chat";
1089
+ declare const MarkChatClosedSubject = "chat.maintenance.mark_closed";
985
1090
  /**
986
1091
  * Agent Session Subjects
987
1092
  */
@@ -1027,5 +1132,27 @@ declare const SetupOrgSubject = "chat.org.setup";
1027
1132
  * Agent Context Subject (for other services to fetch agent context)
1028
1133
  */
1029
1134
  declare const GetAgentContextSubject = "chat.agent-context.get";
1135
+ /**
1136
+ * Memory Subject — the nightly cron entry point. The scheduler service
1137
+ * publishes this; the chat service enumerates every org's KV bucket,
1138
+ * finds chats updated in the last 24h, and summarizes each in-process.
1139
+ * No corresponding "summarize one chat" NATS subject exists — per-chat
1140
+ * summarization is an in-process call (see ChatService.SummarizeChat)
1141
+ * or an HTTP endpoint when we need an admin UI trigger.
1142
+ */
1143
+ declare const TriggerMemorySummarizationSubject = "chat.memory.summarize.nightly";
1144
+ /**
1145
+ * SummarizeChatResponse is returned by ChatService.SummarizeChat (in-process)
1146
+ * and surfaced in nightly-sweep log lines. Kept in the common package so an
1147
+ * HTTP endpoint can reuse the shape when we add an admin trigger.
1148
+ */
1149
+ interface SummarizeChatResponse {
1150
+ orgId: string;
1151
+ chatKey: string;
1152
+ summary?: string;
1153
+ messagesCount: number;
1154
+ skippedReason?: string;
1155
+ error?: string;
1156
+ }
1030
1157
 
1031
- export { type Action, type AgentQueue, type AgentSession, type AgentStatus, AgentStatusAway, AgentStatusBusy, AgentStatusOffline, AgentStatusOnline, type AgentStatusTS, type AssignChatToAgentRequest, type AssignChatToAgentResponse, AssignChatToAgentSubject, type Attachment, type AttachmentFile, type AttachmentProcessingCompleteData, type AttachmentProcessingErrorData, type AttachmentProcessingProgressData, type AttachmentProcessingStartedData, type AttachmentType, AttachmentTypeActions, AttachmentTypeArticles, AttachmentTypeAudio, AttachmentTypeBullets, AttachmentTypeData, AttachmentTypeDataFile, AttachmentTypeDocument, AttachmentTypeDocumentAnalysis, AttachmentTypeDocumentSources, AttachmentTypeImage, AttachmentTypeKGNodes, AttachmentTypeLocation, AttachmentTypeRecords, AttachmentTypeReferences, AttachmentTypeSpreadsheet, AttachmentTypeSticker, AttachmentTypeSubsections, type AttachmentTypeTS, AttachmentTypeVideo, type Chat, type ChatArchivalRequest, type ChatArchivalResponse, ChatArchiveSubjectPattern, type ChatContext, type ChatEvent, type ChatEventType, ChatEventTypeAgentActivityPing, ChatEventTypeAgentChatAssigned, ChatEventTypeAgentChatCompleted, ChatEventTypeAgentContextUpdate, ChatEventTypeAgentExecutionEnded, ChatEventTypeAgentExecutionStarted, ChatEventTypeAgentSessionEnd, ChatEventTypeAgentSessionStart, ChatEventTypeAgentStatusChange, ChatEventTypeAttachmentProcessingComplete, ChatEventTypeAttachmentProcessingError, ChatEventTypeAttachmentProcessingProgress, ChatEventTypeAttachmentProcessingStarted, ChatEventTypeBlockUser, ChatEventTypeCSATRequest, ChatEventTypeCSATResponse, ChatEventTypeCSATSurvey, ChatEventTypeChatEnded, ChatEventTypeChatRemoved, ChatEventTypeChatUpdated, ChatEventTypeClientAction, ChatEventTypeClientActionCallback, ChatEventTypeCreateRoom, ChatEventTypeDeleteRoom, ChatEventTypeDelivered, ChatEventTypeEndChat, ChatEventTypeError, ChatEventTypeGetAgents, ChatEventTypeGetAgentsResponse, ChatEventTypeGetOnlineUsers, ChatEventTypeHumanAgentJoined, ChatEventTypeHumanAgentLeft, ChatEventTypeInviteUser, ChatEventTypeJoinRoom, ChatEventTypeLeaveRoom, ChatEventTypeListChats, ChatEventTypeListRooms, ChatEventTypeLoadAgentContext, ChatEventTypeLoadAgentContextResponse, ChatEventTypeLoadChat, ChatEventTypeLoadChatResponse, ChatEventTypeMentionUser, ChatEventTypeMessage, ChatEventTypeMessageDeleted, ChatEventTypeMessageDeletedResponse, ChatEventTypeMessageEdited, ChatEventTypeMessageEditedResponse, ChatEventTypeMessageReaction, ChatEventTypeMessageReactionResponse, ChatEventTypeMessageReply, ChatEventTypeMessageStatusUpdate, ChatEventTypeNewChat, ChatEventTypeNewChatCreated, ChatEventTypeObserverJoined, ChatEventTypeObserverLeft, ChatEventTypeOnlineUsersResponse, ChatEventTypePing, ChatEventTypePlanApproved, ChatEventTypePlanCompleted, ChatEventTypePlanPendingApproval, ChatEventTypePlanRejected, ChatEventTypePong, ChatEventTypeRead, ChatEventTypeReconnected, ChatEventTypeRetryAttachment, ChatEventTypeRoomCreated, ChatEventTypeRoomDeleted, ChatEventTypeRoomUpdated, ChatEventTypeRoomUserJoined, ChatEventTypeRoomUserLeft, ChatEventTypeRoomsResponse, ChatEventTypeSkillActivate, ChatEventTypeSkillDeactivate, ChatEventTypeSkillsChanged, ChatEventTypeStepCompleted, ChatEventTypeStepFailed, ChatEventTypeStepStarted, ChatEventTypeStoppedTyping, ChatEventTypeSummaryUpdate, ChatEventTypeSyncMetadata, ChatEventTypeSyncMetadataResponse, ChatEventTypeSyncUserSession, ChatEventTypeSyncUserSessionResponse, type ChatEventTypeTS, ChatEventTypeTyping, ChatEventTypeUpdateRoom, ChatEventTypeUserActivity, ChatEventTypeUserActivityUpdate, ChatEventTypeUserInvited, ChatEventTypeUserJoined, ChatEventTypeUserLeft, ChatEventTypeUserPresenceChanged, ChatEventTypeUserPresenceEnd, ChatEventTypeUserPresenceStart, ChatEventTypeUserRemoved, ChatEventTypeUserStatusChange, ChatEventTypeUserSuggestedActionSelected, ChatEventTypeUserSuggestedActions, ChatEventTypeWaiting, ChatEventTypeWaitingForAgent, type ChatFlow, type ChatGrading, type ChatMessage, type ChatProductReference, type ChatQueueInfo, type ChatRateLimits, type ChatRole, ChatRoleAI, ChatRoleDataQuery, ChatRoleEvent, ChatRoleHumanAgent, ChatRoleObserver, ChatRoleSystem, type ChatRoleTS, ChatRoleTool, ChatRoleUser, type ChatSession, type ChatSessionPreferences, type ChatSessionStatus, ChatSessionStatusActive, ChatSessionStatusExpired, ChatSessionStatusIdle, type ChatStatus, ChatStatusAbandoned, ChatStatusActive, ChatStatusArchived, ChatStatusClosed, ChatStatusCompleted, ChatStatusDisconnected, type ChatStatusTS, type ChatStatusUpdate, type ChatSummary, type ChatTool, type ChatType, ChatTypeCustomerSupport, ChatTypeDirect, ChatTypeGroup, ChatTypePrivateRoom, ChatTypePublicRoom, type ChatTypeTS, type ChatUser, type CompleteChatByAgentRequest, type CompleteChatByAgentResponse, CompleteChatByAgentSubject, type CreateAgentQueueRequest, type CreateAgentQueueResponse, CreateAgentQueueSubject, type DeleteAgentQueueRequest, type DeleteAgentQueueResponse, DeleteAgentQueueSubject, type DocumentSource, type EmojiReaction, type EndAgentSessionRequest, type EndAgentSessionResponse, EndAgentSessionSubject, type GetActiveChatCountRequest, type GetActiveChatCountResponse, GetActiveChatCountSubject, type GetActiveChatsRequest, type GetActiveChatsResponse, GetActiveChatsSubject, type GetAgentContextRequest, type GetAgentContextResponse, GetAgentContextSubject, type GetAgentQueuesFilter, type GetAgentQueuesRequest, type GetAgentQueuesResponse, GetAgentQueuesSubject, type GetAgentSessionRequest, type GetAgentSessionResponse, GetAgentSessionSubject, type GetChatRequest, type GetChatResponse, GetChatSubject, type GetDailyChatCountRequest, type GetDailyChatCountResponse, GetDailyChatCountSubject, type GetOnlineAgentCountRequest, type GetOnlineAgentCountResponse, GetOnlineAgentCountSubject, type GetOnlineAgentsRequest, type GetOnlineAgentsResponse, GetOnlineAgentsSubject, type GetOnlineUsersRequest, type GetOnlineUsersResponse, GetOnlineUsersSubject, type GetQueueChatCountRequest, type GetQueueChatCountResponse, GetQueueChatCountSubject, type GetQueueChatsRequest, type GetQueueChatsResponse, GetQueueChatsSubject, type GetUserChatsRequest, type GetUserChatsResponse, GetUserChatsSubject, type GetWaitingForAgentChatCountRequest, type GetWaitingForAgentChatCountResponse, GetWaitingForAgentChatCountSubject, type GetWaitingForAgentChatsRequest, type GetWaitingForAgentChatsResponse, GetWaitingForAgentChatsSubject, type LLMConfig, type LLMFunction, type LLMMemoryConfig, type LLMResponse, type LLMTool, type LLMUsage, type Location, type MessageStatus, MessageStatusDelivered, MessageStatusFailed, MessageStatusRead, MessageStatusSending, MessageStatusSent, type MessageStatusTS, type QueueType, QueueTypeComplexity, QueueTypeDepartment, type QueueTypeOptionTS, QueueTypePriority, QueueTypeSkill, type QueueTypeTS, QueueTypes, type RetryAttachmentData, SetupOrgSubject, type StartAgentSessionRequest, type StartAgentSessionResponse, StartAgentSessionSubject, type ToolCall, type TriggerAnalyticsScanRequest, type TriggerAnalyticsScanResponse, TriggerAnalyticsScanSubject, type UpdateAgentLastActivityRequest, type UpdateAgentLastActivityResponse, UpdateAgentLastActivitySubject, type UpdateAgentQueueRequest, type UpdateAgentQueueResponse, UpdateAgentQueueSubject, type UpdateAgentStatusRequest, type UpdateAgentStatusResponse, UpdateAgentStatusSubject, type UpdateUserStatusRequest, type UpdateUserStatusResponse, UpdateUserStatusSubject, type UserSession, type UserStatus, UserStatusAway, UserStatusBusy, UserStatusOffline, UserStatusOnline, type UserStatusTS };
1158
+ export { type Action, type AgentQueue, type AgentSession, type AgentStatus, AgentStatusAway, AgentStatusBusy, AgentStatusOffline, AgentStatusOnline, type AgentStatusTS, type AssignChatToAgentRequest, type AssignChatToAgentResponse, AssignChatToAgentSubject, type Attachment, type AttachmentFile, type AttachmentProcessingCompleteData, type AttachmentProcessingErrorData, type AttachmentProcessingProgressData, type AttachmentProcessingStartedData, type AttachmentType, AttachmentTypeActions, AttachmentTypeArticles, AttachmentTypeAudio, AttachmentTypeBullets, AttachmentTypeData, AttachmentTypeDataFile, AttachmentTypeDocument, AttachmentTypeDocumentAnalysis, AttachmentTypeDocumentSources, AttachmentTypeImage, AttachmentTypeKGNodes, AttachmentTypeLocation, AttachmentTypeRecords, AttachmentTypeReferences, AttachmentTypeSpreadsheet, AttachmentTypeSticker, AttachmentTypeSubsections, type AttachmentTypeTS, AttachmentTypeVideo, type Chat, type ChatArchivalRequest, type ChatArchivalResponse, ChatArchiveSubjectPattern, type ChatContext, type ChatEvent, type ChatEventType, ChatEventTypeAgentActivityPing, ChatEventTypeAgentChatAssigned, ChatEventTypeAgentChatCompleted, ChatEventTypeAgentContextUpdate, ChatEventTypeAgentExecutionEnded, ChatEventTypeAgentExecutionStarted, ChatEventTypeAgentSessionEnd, ChatEventTypeAgentSessionStart, ChatEventTypeAgentStatusChange, ChatEventTypeAttachmentProcessingComplete, ChatEventTypeAttachmentProcessingError, ChatEventTypeAttachmentProcessingProgress, ChatEventTypeAttachmentProcessingStarted, ChatEventTypeBlockUser, ChatEventTypeCSATRequest, ChatEventTypeCSATResponse, ChatEventTypeCSATSurvey, ChatEventTypeChatEnded, ChatEventTypeChatRemoved, ChatEventTypeChatUpdated, ChatEventTypeClientAction, ChatEventTypeClientActionCallback, ChatEventTypeCreateRoom, ChatEventTypeDeleteRoom, ChatEventTypeDelivered, ChatEventTypeEndChat, ChatEventTypeError, ChatEventTypeGetAgents, ChatEventTypeGetAgentsResponse, ChatEventTypeGetOnlineUsers, ChatEventTypeHumanAgentJoined, ChatEventTypeHumanAgentLeft, ChatEventTypeInviteUser, ChatEventTypeJoinRoom, ChatEventTypeLeaveRoom, ChatEventTypeListChats, ChatEventTypeListRooms, ChatEventTypeLoadAgentContext, ChatEventTypeLoadAgentContextResponse, ChatEventTypeLoadChat, ChatEventTypeLoadChatResponse, ChatEventTypeMentionUser, ChatEventTypeMessage, ChatEventTypeMessageDeleted, ChatEventTypeMessageDeletedResponse, ChatEventTypeMessageEdited, ChatEventTypeMessageEditedResponse, ChatEventTypeMessageReaction, ChatEventTypeMessageReactionResponse, ChatEventTypeMessageReply, ChatEventTypeMessageStatusUpdate, ChatEventTypeNewChat, ChatEventTypeNewChatCreated, ChatEventTypeObserverJoined, ChatEventTypeObserverLeft, ChatEventTypeOnlineUsersResponse, ChatEventTypePing, ChatEventTypePlanApproved, ChatEventTypePlanCompleted, ChatEventTypePlanPendingApproval, ChatEventTypePlanRejected, ChatEventTypePong, ChatEventTypeRead, ChatEventTypeReconnected, ChatEventTypeRetryAttachment, ChatEventTypeRoomCreated, ChatEventTypeRoomDeleted, ChatEventTypeRoomUpdated, ChatEventTypeRoomUserJoined, ChatEventTypeRoomUserLeft, ChatEventTypeRoomsResponse, ChatEventTypeSkillActivate, ChatEventTypeSkillDeactivate, ChatEventTypeSkillsChanged, ChatEventTypeStepCompleted, ChatEventTypeStepFailed, ChatEventTypeStepStarted, ChatEventTypeStoppedTyping, ChatEventTypeSummaryUpdate, ChatEventTypeSyncMetadata, ChatEventTypeSyncMetadataResponse, ChatEventTypeSyncUserSession, ChatEventTypeSyncUserSessionResponse, type ChatEventTypeTS, ChatEventTypeTransportReconnected, ChatEventTypeTyping, ChatEventTypeUpdateRoom, ChatEventTypeUserActivity, ChatEventTypeUserActivityUpdate, ChatEventTypeUserInvited, ChatEventTypeUserJoined, ChatEventTypeUserLeft, ChatEventTypeUserPresenceChanged, ChatEventTypeUserPresenceEnd, ChatEventTypeUserPresenceStart, ChatEventTypeUserRemoved, ChatEventTypeUserStatusChange, ChatEventTypeUserSuggestedActionSelected, ChatEventTypeUserSuggestedActions, ChatEventTypeWaiting, ChatEventTypeWaitingForAgent, type ChatFlow, type ChatGrading, type ChatMessage, type ChatMessageError, type ChatProductReference, type ChatQueueInfo, type ChatRateLimits, type ChatRole, ChatRoleAI, ChatRoleDataQuery, ChatRoleEvent, ChatRoleHumanAgent, ChatRoleObserver, ChatRoleSystem, type ChatRoleTS, ChatRoleTool, ChatRoleUser, type ChatSession, type ChatSessionPreferences, type ChatSessionStatus, ChatSessionStatusActive, ChatSessionStatusExpired, ChatSessionStatusIdle, type ChatStatus, ChatStatusAbandoned, ChatStatusActive, ChatStatusArchived, ChatStatusClosed, ChatStatusCompleted, ChatStatusDisconnected, type ChatStatusTS, type ChatStatusUpdate, type ChatSummary, type ChatTool, type ChatType, ChatTypeCustomerSupport, ChatTypeDirect, ChatTypeGroup, ChatTypePrivateRoom, ChatTypePublicRoom, type ChatTypeTS, type ChatUser, CloseAndDeleteChatSubject, type CloseChatRequest, type CloseChatResponse, type CompleteChatByAgentRequest, type CompleteChatByAgentResponse, CompleteChatByAgentSubject, type CreateAgentQueueRequest, type CreateAgentQueueResponse, CreateAgentQueueSubject, type DeleteAgentQueueRequest, type DeleteAgentQueueResponse, DeleteAgentQueueSubject, type DocumentSource, type EmojiReaction, type EndAgentSessionRequest, type EndAgentSessionResponse, EndAgentSessionSubject, type GetActiveChatCountRequest, type GetActiveChatCountResponse, GetActiveChatCountSubject, type GetActiveChatsRequest, type GetActiveChatsResponse, GetActiveChatsSubject, type GetAgentContextRequest, type GetAgentContextResponse, GetAgentContextSubject, type GetAgentQueuesFilter, type GetAgentQueuesRequest, type GetAgentQueuesResponse, GetAgentQueuesSubject, type GetAgentSessionRequest, type GetAgentSessionResponse, GetAgentSessionSubject, type GetChatRequest, type GetChatResponse, GetChatSubject, type GetDailyChatCountRequest, type GetDailyChatCountResponse, GetDailyChatCountSubject, type GetOnlineAgentCountRequest, type GetOnlineAgentCountResponse, GetOnlineAgentCountSubject, type GetOnlineAgentsRequest, type GetOnlineAgentsResponse, GetOnlineAgentsSubject, type GetOnlineUsersRequest, type GetOnlineUsersResponse, GetOnlineUsersSubject, type GetQueueChatCountRequest, type GetQueueChatCountResponse, GetQueueChatCountSubject, type GetQueueChatsRequest, type GetQueueChatsResponse, GetQueueChatsSubject, type GetUserChatsRequest, type GetUserChatsResponse, GetUserChatsSubject, type GetWaitingForAgentChatCountRequest, type GetWaitingForAgentChatCountResponse, GetWaitingForAgentChatCountSubject, type GetWaitingForAgentChatsRequest, type GetWaitingForAgentChatsResponse, GetWaitingForAgentChatsSubject, type LLMConfig, type LLMFunction, type LLMMemoryConfig, type LLMResponse, type LLMTool, type LLMUsage, type ListIdleChatsRequest, type ListIdleChatsResponse, ListIdleChatsSubject, type Location, MarkChatClosedSubject, type MemoryContact, type MemoryNote, type MemoryProfile, type MessageStatus, MessageStatusDelivered, MessageStatusFailed, MessageStatusRead, MessageStatusSending, MessageStatusSent, type MessageStatusTS, type QueueType, QueueTypeComplexity, QueueTypeDepartment, type QueueTypeOptionTS, QueueTypePriority, QueueTypeSkill, type QueueTypeTS, QueueTypes, type RetryAttachmentData, SetupOrgSubject, type StartAgentSessionRequest, type StartAgentSessionResponse, StartAgentSessionSubject, type SummarizeChatResponse, type ToolCall, type TriggerAnalyticsScanRequest, type TriggerAnalyticsScanResponse, TriggerAnalyticsScanSubject, TriggerMemorySummarizationSubject, type UpdateAgentLastActivityRequest, type UpdateAgentLastActivityResponse, UpdateAgentLastActivitySubject, type UpdateAgentQueueRequest, type UpdateAgentQueueResponse, UpdateAgentQueueSubject, type UpdateAgentStatusRequest, type UpdateAgentStatusResponse, UpdateAgentStatusSubject, type UpdateUserStatusRequest, type UpdateUserStatusResponse, UpdateUserStatusSubject, type UserSession, type UserStatus, UserStatusAway, UserStatusBusy, UserStatusOffline, UserStatusOnline, type UserStatusTS };
@@ -158,6 +158,12 @@ declare const ChatEventTypeStoppedTyping: ChatEventType;
158
158
  declare const ChatEventTypeRead: ChatEventType;
159
159
  declare const ChatEventTypeDelivered: ChatEventType;
160
160
  declare const ChatEventTypeReconnected: ChatEventType;
161
+ /**
162
+ * ChatEventTypeTransportReconnected is CLIENT-SYNTHETIC: emitted by the
163
+ * browser SSE transport when it re-establishes a dropped stream, so the
164
+ * app layer can re-sync chat state. Never sent by the server.
165
+ */
166
+ declare const ChatEventTypeTransportReconnected: ChatEventType;
161
167
  declare const ChatEventTypeError: ChatEventType;
162
168
  declare const ChatEventTypeWaiting: ChatEventType;
163
169
  declare const ChatEventTypeLoadChat: ChatEventType;
@@ -295,7 +301,7 @@ declare const ChatEventTypeAttachmentProcessingProgress: ChatEventType;
295
301
  declare const ChatEventTypeAttachmentProcessingComplete: ChatEventType;
296
302
  declare const ChatEventTypeAttachmentProcessingError: ChatEventType;
297
303
  declare const ChatEventTypeRetryAttachment: ChatEventType;
298
- type ChatEventTypeTS = "message" | "user_joined" | "user_left" | "typing" | "stopped_typing" | "read" | "delivered" | "reconnected" | "error" | "message_status_update" | "load_chat" | "load_chat_response" | "waiting" | "waiting_for_agent" | "human_agent_joined" | "end_chat" | "chat_ended" | "human_agent_left" | "observer_joined" | "observer_left" | "list_chats" | "chat_updated" | "chat_removed" | "sync_metadata" | "sync_metadata_response" | "sync_user_session" | "sync_user_session_response" | "agent_session_start" | "agent_session_end" | "agent_status_change" | "agent_activity_ping" | "agent_chat_assigned" | "agent_chat_completed" | "client_action" | "client_action_callback" | "show_csat_survey" | "csat_response" | "user_suggested_actions" | "user_suggested_action_selected" | "summary_update" | "agent_context_update" | "agent_execution_started" | "agent_execution_ended" | "load_agent_context" | "load_agent_context_response" | "plan_pending_approval" | "plan_approved" | "plan_rejected" | "plan_completed" | "step_started" | "step_completed" | "step_failed" | "new_chat" | "new_chat_created" | "block_user" | "ping" | "pong" | "create_room" | "room_created" | "join_room" | "leave_room" | "delete_room" | "room_deleted" | "update_room" | "room_updated" | "invite_user" | "user_invited" | "room_user_joined" | "room_user_left" | "user_removed" | "list_rooms" | "rooms_response" | "message_edited" | "message_deleted" | "message_reaction" | "message_reply" | "mention_user" | "message_edited_response" | "message_deleted_response" | "message_reaction_response" | "user_presence_start" | "user_presence_end" | "user_status_change" | "user_activity" | "user_presence_changed" | "user_activity_update" | "get_online_users" | "online_users" | "get_agents" | "get_agents_response" | "skill_activate" | "skill_deactivate" | "skills_changed" | "attachment_processing_started" | "attachment_processing_progress" | "attachment_processing_complete" | "attachment_processing_error" | "retry_attachment";
304
+ type ChatEventTypeTS = "message" | "user_joined" | "user_left" | "typing" | "stopped_typing" | "read" | "delivered" | "reconnected" | "transport_reconnected" | "error" | "message_status_update" | "load_chat" | "load_chat_response" | "waiting" | "waiting_for_agent" | "human_agent_joined" | "end_chat" | "chat_ended" | "human_agent_left" | "observer_joined" | "observer_left" | "list_chats" | "chat_updated" | "chat_removed" | "sync_metadata" | "sync_metadata_response" | "sync_user_session" | "sync_user_session_response" | "agent_session_start" | "agent_session_end" | "agent_status_change" | "agent_activity_ping" | "agent_chat_assigned" | "agent_chat_completed" | "client_action" | "client_action_callback" | "show_csat_survey" | "csat_response" | "user_suggested_actions" | "user_suggested_action_selected" | "summary_update" | "agent_context_update" | "agent_execution_started" | "agent_execution_ended" | "load_agent_context" | "load_agent_context_response" | "plan_pending_approval" | "plan_approved" | "plan_rejected" | "plan_completed" | "step_started" | "step_completed" | "step_failed" | "new_chat" | "new_chat_created" | "block_user" | "ping" | "pong" | "create_room" | "room_created" | "join_room" | "leave_room" | "delete_room" | "room_deleted" | "update_room" | "room_updated" | "invite_user" | "user_invited" | "room_user_joined" | "room_user_left" | "user_removed" | "list_rooms" | "rooms_response" | "message_edited" | "message_deleted" | "message_reaction" | "message_reply" | "mention_user" | "message_edited_response" | "message_deleted_response" | "message_reaction_response" | "user_presence_start" | "user_presence_end" | "user_status_change" | "user_activity" | "user_presence_changed" | "user_activity_update" | "get_online_users" | "online_users" | "get_agents" | "get_agents_response" | "skill_activate" | "skill_deactivate" | "skills_changed" | "attachment_processing_started" | "attachment_processing_progress" | "attachment_processing_complete" | "attachment_processing_error" | "retry_attachment";
299
305
  type MessageStatus = string;
300
306
  declare const MessageStatusSending: MessageStatus;
301
307
  declare const MessageStatusSent: MessageStatus;
@@ -443,6 +449,20 @@ interface ChatMessage {
443
449
  * LLM usage
444
450
  */
445
451
  llmUsage?: LLMUsage;
452
+ /**
453
+ * Error details for synthetic error messages (rendered in-chat when a
454
+ * turn fails; see ChatEventTypeError). Nil for normal messages.
455
+ */
456
+ error?: ChatMessageError;
457
+ }
458
+ /**
459
+ * ChatMessageError is the client-facing payload of a failed turn: a stable
460
+ * code (e.g. LLM_FAILURE, TURN_TIMEOUT) and whether resending the original
461
+ * user message is worth offering.
462
+ */
463
+ interface ChatMessageError {
464
+ code?: string;
465
+ retryable?: boolean;
446
466
  }
447
467
  interface ChatEvent {
448
468
  type: ChatEventTypeTS;
@@ -503,6 +523,18 @@ interface LLMConfig {
503
523
  SystemPrompt: string;
504
524
  Tools: LLMTool[];
505
525
  Memory?: LLMMemoryConfig;
526
+ /**
527
+ * PreferredLanguage, when non-empty, locks the assistant's reply
528
+ * language for this turn — overriding the per-message detection
529
+ * providers would otherwise run on messages[0]. Sourced from the
530
+ * user's stored profile so a user who speaks both Arabic and English
531
+ * gets the language they actually prefer instead of whichever one
532
+ * happened to dominate their first utterance (especially relevant
533
+ * for voice notes, where Whisper sometimes mislabels mixed speech).
534
+ * Use the human-readable form ("English", "Arabic", "French") that
535
+ * the providers prepend straight into "Speak only in <lang>.".
536
+ */
537
+ PreferredLanguage: string;
506
538
  }
507
539
  interface LLMMemoryConfig {
508
540
  MaxMessages: number;
@@ -533,6 +565,7 @@ interface LLMResponse {
533
565
  ToolCalls: ToolCall[];
534
566
  Usage?: LLMUsage;
535
567
  ResponseId: string;
568
+ Truncated: boolean;
536
569
  }
537
570
  interface LLMUsage {
538
571
  inputTokens: number;
@@ -836,6 +869,71 @@ interface GetAgentContextResponse {
836
869
  agentContext: any;
837
870
  metadata: ResponseMetadata;
838
871
  }
872
+ /**
873
+ * ListIdleChatsRequest asks for chats idle longer than IdleMinutes, optionally
874
+ * filtered to a single product (metadata.product). Product is only a filter —
875
+ * the chat service applies no policy of its own.
876
+ */
877
+ interface ListIdleChatsRequest {
878
+ idleMinutes: number;
879
+ product: string;
880
+ limit: number;
881
+ }
882
+ /**
883
+ * ListIdleChatsResponse returns the matching chats (full objects, so the caller
884
+ * can write analytics without a second round-trip).
885
+ */
886
+ interface ListIdleChatsResponse {
887
+ chats: Chat[];
888
+ metadata: ResponseMetadata;
889
+ }
890
+ /**
891
+ * CloseChatRequest targets a single chat by org + key (used by both
892
+ * close-and-delete and mark-closed).
893
+ */
894
+ interface CloseChatRequest {
895
+ orgId: string;
896
+ chatKey: string;
897
+ }
898
+ interface CloseChatResponse {
899
+ metadata: ResponseMetadata;
900
+ }
901
+ interface MemoryContact {
902
+ name: string;
903
+ role?: string;
904
+ notes?: string;
905
+ lastMentionedAt?: number;
906
+ }
907
+ interface MemoryNote {
908
+ text: string;
909
+ extractedAt?: number;
910
+ source?: string;
911
+ }
912
+ interface MemoryProfile {
913
+ preferredName?: string;
914
+ timezone?: string;
915
+ language?: string;
916
+ company?: string;
917
+ role?: string;
918
+ /**
919
+ * Mobile is the user's own WhatsApp/phone number (E.164, digits-only).
920
+ * Captured explicitly at onboarding / Memory edit (NOT auto-extracted) and
921
+ * rendered into the agent system prompt via renderUserProfile, so an agent
922
+ * can message the user on their own number (e.g. send_whatsapp_on_behalf).
923
+ */
924
+ mobile?: string;
925
+ /**
926
+ * Email is a denormalized copy of the admin user's email so the agent
927
+ * prompt carries it alongside mobile regardless of signup channel. The
928
+ * admin users table stays the identity source of truth — patching this
929
+ * field never changes the login email.
930
+ */
931
+ email?: string;
932
+ contacts?: MemoryContact[];
933
+ notes?: MemoryNote[];
934
+ version: number;
935
+ updatedAt: number;
936
+ }
839
937
  declare const QueueTypes: {
840
938
  readonly skill: {
841
939
  readonly value: "skill";
@@ -982,6 +1080,13 @@ declare const GetChatSubject = "chat.get_chat";
982
1080
  * Chat Archival Subjects
983
1081
  */
984
1082
  declare const ChatArchiveSubjectPattern = "chat.archive.%s.server";
1083
+ /**
1084
+ * Chat Maintenance Subjects (generic, product-agnostic; product backends
1085
+ * call these to drive their own retention/lifecycle policy).
1086
+ */
1087
+ declare const ListIdleChatsSubject = "chat.maintenance.list_idle_chats";
1088
+ declare const CloseAndDeleteChatSubject = "chat.maintenance.close_and_delete_chat";
1089
+ declare const MarkChatClosedSubject = "chat.maintenance.mark_closed";
985
1090
  /**
986
1091
  * Agent Session Subjects
987
1092
  */
@@ -1027,5 +1132,27 @@ declare const SetupOrgSubject = "chat.org.setup";
1027
1132
  * Agent Context Subject (for other services to fetch agent context)
1028
1133
  */
1029
1134
  declare const GetAgentContextSubject = "chat.agent-context.get";
1135
+ /**
1136
+ * Memory Subject — the nightly cron entry point. The scheduler service
1137
+ * publishes this; the chat service enumerates every org's KV bucket,
1138
+ * finds chats updated in the last 24h, and summarizes each in-process.
1139
+ * No corresponding "summarize one chat" NATS subject exists — per-chat
1140
+ * summarization is an in-process call (see ChatService.SummarizeChat)
1141
+ * or an HTTP endpoint when we need an admin UI trigger.
1142
+ */
1143
+ declare const TriggerMemorySummarizationSubject = "chat.memory.summarize.nightly";
1144
+ /**
1145
+ * SummarizeChatResponse is returned by ChatService.SummarizeChat (in-process)
1146
+ * and surfaced in nightly-sweep log lines. Kept in the common package so an
1147
+ * HTTP endpoint can reuse the shape when we add an admin trigger.
1148
+ */
1149
+ interface SummarizeChatResponse {
1150
+ orgId: string;
1151
+ chatKey: string;
1152
+ summary?: string;
1153
+ messagesCount: number;
1154
+ skippedReason?: string;
1155
+ error?: string;
1156
+ }
1030
1157
 
1031
- export { type Action, type AgentQueue, type AgentSession, type AgentStatus, AgentStatusAway, AgentStatusBusy, AgentStatusOffline, AgentStatusOnline, type AgentStatusTS, type AssignChatToAgentRequest, type AssignChatToAgentResponse, AssignChatToAgentSubject, type Attachment, type AttachmentFile, type AttachmentProcessingCompleteData, type AttachmentProcessingErrorData, type AttachmentProcessingProgressData, type AttachmentProcessingStartedData, type AttachmentType, AttachmentTypeActions, AttachmentTypeArticles, AttachmentTypeAudio, AttachmentTypeBullets, AttachmentTypeData, AttachmentTypeDataFile, AttachmentTypeDocument, AttachmentTypeDocumentAnalysis, AttachmentTypeDocumentSources, AttachmentTypeImage, AttachmentTypeKGNodes, AttachmentTypeLocation, AttachmentTypeRecords, AttachmentTypeReferences, AttachmentTypeSpreadsheet, AttachmentTypeSticker, AttachmentTypeSubsections, type AttachmentTypeTS, AttachmentTypeVideo, type Chat, type ChatArchivalRequest, type ChatArchivalResponse, ChatArchiveSubjectPattern, type ChatContext, type ChatEvent, type ChatEventType, ChatEventTypeAgentActivityPing, ChatEventTypeAgentChatAssigned, ChatEventTypeAgentChatCompleted, ChatEventTypeAgentContextUpdate, ChatEventTypeAgentExecutionEnded, ChatEventTypeAgentExecutionStarted, ChatEventTypeAgentSessionEnd, ChatEventTypeAgentSessionStart, ChatEventTypeAgentStatusChange, ChatEventTypeAttachmentProcessingComplete, ChatEventTypeAttachmentProcessingError, ChatEventTypeAttachmentProcessingProgress, ChatEventTypeAttachmentProcessingStarted, ChatEventTypeBlockUser, ChatEventTypeCSATRequest, ChatEventTypeCSATResponse, ChatEventTypeCSATSurvey, ChatEventTypeChatEnded, ChatEventTypeChatRemoved, ChatEventTypeChatUpdated, ChatEventTypeClientAction, ChatEventTypeClientActionCallback, ChatEventTypeCreateRoom, ChatEventTypeDeleteRoom, ChatEventTypeDelivered, ChatEventTypeEndChat, ChatEventTypeError, ChatEventTypeGetAgents, ChatEventTypeGetAgentsResponse, ChatEventTypeGetOnlineUsers, ChatEventTypeHumanAgentJoined, ChatEventTypeHumanAgentLeft, ChatEventTypeInviteUser, ChatEventTypeJoinRoom, ChatEventTypeLeaveRoom, ChatEventTypeListChats, ChatEventTypeListRooms, ChatEventTypeLoadAgentContext, ChatEventTypeLoadAgentContextResponse, ChatEventTypeLoadChat, ChatEventTypeLoadChatResponse, ChatEventTypeMentionUser, ChatEventTypeMessage, ChatEventTypeMessageDeleted, ChatEventTypeMessageDeletedResponse, ChatEventTypeMessageEdited, ChatEventTypeMessageEditedResponse, ChatEventTypeMessageReaction, ChatEventTypeMessageReactionResponse, ChatEventTypeMessageReply, ChatEventTypeMessageStatusUpdate, ChatEventTypeNewChat, ChatEventTypeNewChatCreated, ChatEventTypeObserverJoined, ChatEventTypeObserverLeft, ChatEventTypeOnlineUsersResponse, ChatEventTypePing, ChatEventTypePlanApproved, ChatEventTypePlanCompleted, ChatEventTypePlanPendingApproval, ChatEventTypePlanRejected, ChatEventTypePong, ChatEventTypeRead, ChatEventTypeReconnected, ChatEventTypeRetryAttachment, ChatEventTypeRoomCreated, ChatEventTypeRoomDeleted, ChatEventTypeRoomUpdated, ChatEventTypeRoomUserJoined, ChatEventTypeRoomUserLeft, ChatEventTypeRoomsResponse, ChatEventTypeSkillActivate, ChatEventTypeSkillDeactivate, ChatEventTypeSkillsChanged, ChatEventTypeStepCompleted, ChatEventTypeStepFailed, ChatEventTypeStepStarted, ChatEventTypeStoppedTyping, ChatEventTypeSummaryUpdate, ChatEventTypeSyncMetadata, ChatEventTypeSyncMetadataResponse, ChatEventTypeSyncUserSession, ChatEventTypeSyncUserSessionResponse, type ChatEventTypeTS, ChatEventTypeTyping, ChatEventTypeUpdateRoom, ChatEventTypeUserActivity, ChatEventTypeUserActivityUpdate, ChatEventTypeUserInvited, ChatEventTypeUserJoined, ChatEventTypeUserLeft, ChatEventTypeUserPresenceChanged, ChatEventTypeUserPresenceEnd, ChatEventTypeUserPresenceStart, ChatEventTypeUserRemoved, ChatEventTypeUserStatusChange, ChatEventTypeUserSuggestedActionSelected, ChatEventTypeUserSuggestedActions, ChatEventTypeWaiting, ChatEventTypeWaitingForAgent, type ChatFlow, type ChatGrading, type ChatMessage, type ChatProductReference, type ChatQueueInfo, type ChatRateLimits, type ChatRole, ChatRoleAI, ChatRoleDataQuery, ChatRoleEvent, ChatRoleHumanAgent, ChatRoleObserver, ChatRoleSystem, type ChatRoleTS, ChatRoleTool, ChatRoleUser, type ChatSession, type ChatSessionPreferences, type ChatSessionStatus, ChatSessionStatusActive, ChatSessionStatusExpired, ChatSessionStatusIdle, type ChatStatus, ChatStatusAbandoned, ChatStatusActive, ChatStatusArchived, ChatStatusClosed, ChatStatusCompleted, ChatStatusDisconnected, type ChatStatusTS, type ChatStatusUpdate, type ChatSummary, type ChatTool, type ChatType, ChatTypeCustomerSupport, ChatTypeDirect, ChatTypeGroup, ChatTypePrivateRoom, ChatTypePublicRoom, type ChatTypeTS, type ChatUser, type CompleteChatByAgentRequest, type CompleteChatByAgentResponse, CompleteChatByAgentSubject, type CreateAgentQueueRequest, type CreateAgentQueueResponse, CreateAgentQueueSubject, type DeleteAgentQueueRequest, type DeleteAgentQueueResponse, DeleteAgentQueueSubject, type DocumentSource, type EmojiReaction, type EndAgentSessionRequest, type EndAgentSessionResponse, EndAgentSessionSubject, type GetActiveChatCountRequest, type GetActiveChatCountResponse, GetActiveChatCountSubject, type GetActiveChatsRequest, type GetActiveChatsResponse, GetActiveChatsSubject, type GetAgentContextRequest, type GetAgentContextResponse, GetAgentContextSubject, type GetAgentQueuesFilter, type GetAgentQueuesRequest, type GetAgentQueuesResponse, GetAgentQueuesSubject, type GetAgentSessionRequest, type GetAgentSessionResponse, GetAgentSessionSubject, type GetChatRequest, type GetChatResponse, GetChatSubject, type GetDailyChatCountRequest, type GetDailyChatCountResponse, GetDailyChatCountSubject, type GetOnlineAgentCountRequest, type GetOnlineAgentCountResponse, GetOnlineAgentCountSubject, type GetOnlineAgentsRequest, type GetOnlineAgentsResponse, GetOnlineAgentsSubject, type GetOnlineUsersRequest, type GetOnlineUsersResponse, GetOnlineUsersSubject, type GetQueueChatCountRequest, type GetQueueChatCountResponse, GetQueueChatCountSubject, type GetQueueChatsRequest, type GetQueueChatsResponse, GetQueueChatsSubject, type GetUserChatsRequest, type GetUserChatsResponse, GetUserChatsSubject, type GetWaitingForAgentChatCountRequest, type GetWaitingForAgentChatCountResponse, GetWaitingForAgentChatCountSubject, type GetWaitingForAgentChatsRequest, type GetWaitingForAgentChatsResponse, GetWaitingForAgentChatsSubject, type LLMConfig, type LLMFunction, type LLMMemoryConfig, type LLMResponse, type LLMTool, type LLMUsage, type Location, type MessageStatus, MessageStatusDelivered, MessageStatusFailed, MessageStatusRead, MessageStatusSending, MessageStatusSent, type MessageStatusTS, type QueueType, QueueTypeComplexity, QueueTypeDepartment, type QueueTypeOptionTS, QueueTypePriority, QueueTypeSkill, type QueueTypeTS, QueueTypes, type RetryAttachmentData, SetupOrgSubject, type StartAgentSessionRequest, type StartAgentSessionResponse, StartAgentSessionSubject, type ToolCall, type TriggerAnalyticsScanRequest, type TriggerAnalyticsScanResponse, TriggerAnalyticsScanSubject, type UpdateAgentLastActivityRequest, type UpdateAgentLastActivityResponse, UpdateAgentLastActivitySubject, type UpdateAgentQueueRequest, type UpdateAgentQueueResponse, UpdateAgentQueueSubject, type UpdateAgentStatusRequest, type UpdateAgentStatusResponse, UpdateAgentStatusSubject, type UpdateUserStatusRequest, type UpdateUserStatusResponse, UpdateUserStatusSubject, type UserSession, type UserStatus, UserStatusAway, UserStatusBusy, UserStatusOffline, UserStatusOnline, type UserStatusTS };
1158
+ export { type Action, type AgentQueue, type AgentSession, type AgentStatus, AgentStatusAway, AgentStatusBusy, AgentStatusOffline, AgentStatusOnline, type AgentStatusTS, type AssignChatToAgentRequest, type AssignChatToAgentResponse, AssignChatToAgentSubject, type Attachment, type AttachmentFile, type AttachmentProcessingCompleteData, type AttachmentProcessingErrorData, type AttachmentProcessingProgressData, type AttachmentProcessingStartedData, type AttachmentType, AttachmentTypeActions, AttachmentTypeArticles, AttachmentTypeAudio, AttachmentTypeBullets, AttachmentTypeData, AttachmentTypeDataFile, AttachmentTypeDocument, AttachmentTypeDocumentAnalysis, AttachmentTypeDocumentSources, AttachmentTypeImage, AttachmentTypeKGNodes, AttachmentTypeLocation, AttachmentTypeRecords, AttachmentTypeReferences, AttachmentTypeSpreadsheet, AttachmentTypeSticker, AttachmentTypeSubsections, type AttachmentTypeTS, AttachmentTypeVideo, type Chat, type ChatArchivalRequest, type ChatArchivalResponse, ChatArchiveSubjectPattern, type ChatContext, type ChatEvent, type ChatEventType, ChatEventTypeAgentActivityPing, ChatEventTypeAgentChatAssigned, ChatEventTypeAgentChatCompleted, ChatEventTypeAgentContextUpdate, ChatEventTypeAgentExecutionEnded, ChatEventTypeAgentExecutionStarted, ChatEventTypeAgentSessionEnd, ChatEventTypeAgentSessionStart, ChatEventTypeAgentStatusChange, ChatEventTypeAttachmentProcessingComplete, ChatEventTypeAttachmentProcessingError, ChatEventTypeAttachmentProcessingProgress, ChatEventTypeAttachmentProcessingStarted, ChatEventTypeBlockUser, ChatEventTypeCSATRequest, ChatEventTypeCSATResponse, ChatEventTypeCSATSurvey, ChatEventTypeChatEnded, ChatEventTypeChatRemoved, ChatEventTypeChatUpdated, ChatEventTypeClientAction, ChatEventTypeClientActionCallback, ChatEventTypeCreateRoom, ChatEventTypeDeleteRoom, ChatEventTypeDelivered, ChatEventTypeEndChat, ChatEventTypeError, ChatEventTypeGetAgents, ChatEventTypeGetAgentsResponse, ChatEventTypeGetOnlineUsers, ChatEventTypeHumanAgentJoined, ChatEventTypeHumanAgentLeft, ChatEventTypeInviteUser, ChatEventTypeJoinRoom, ChatEventTypeLeaveRoom, ChatEventTypeListChats, ChatEventTypeListRooms, ChatEventTypeLoadAgentContext, ChatEventTypeLoadAgentContextResponse, ChatEventTypeLoadChat, ChatEventTypeLoadChatResponse, ChatEventTypeMentionUser, ChatEventTypeMessage, ChatEventTypeMessageDeleted, ChatEventTypeMessageDeletedResponse, ChatEventTypeMessageEdited, ChatEventTypeMessageEditedResponse, ChatEventTypeMessageReaction, ChatEventTypeMessageReactionResponse, ChatEventTypeMessageReply, ChatEventTypeMessageStatusUpdate, ChatEventTypeNewChat, ChatEventTypeNewChatCreated, ChatEventTypeObserverJoined, ChatEventTypeObserverLeft, ChatEventTypeOnlineUsersResponse, ChatEventTypePing, ChatEventTypePlanApproved, ChatEventTypePlanCompleted, ChatEventTypePlanPendingApproval, ChatEventTypePlanRejected, ChatEventTypePong, ChatEventTypeRead, ChatEventTypeReconnected, ChatEventTypeRetryAttachment, ChatEventTypeRoomCreated, ChatEventTypeRoomDeleted, ChatEventTypeRoomUpdated, ChatEventTypeRoomUserJoined, ChatEventTypeRoomUserLeft, ChatEventTypeRoomsResponse, ChatEventTypeSkillActivate, ChatEventTypeSkillDeactivate, ChatEventTypeSkillsChanged, ChatEventTypeStepCompleted, ChatEventTypeStepFailed, ChatEventTypeStepStarted, ChatEventTypeStoppedTyping, ChatEventTypeSummaryUpdate, ChatEventTypeSyncMetadata, ChatEventTypeSyncMetadataResponse, ChatEventTypeSyncUserSession, ChatEventTypeSyncUserSessionResponse, type ChatEventTypeTS, ChatEventTypeTransportReconnected, ChatEventTypeTyping, ChatEventTypeUpdateRoom, ChatEventTypeUserActivity, ChatEventTypeUserActivityUpdate, ChatEventTypeUserInvited, ChatEventTypeUserJoined, ChatEventTypeUserLeft, ChatEventTypeUserPresenceChanged, ChatEventTypeUserPresenceEnd, ChatEventTypeUserPresenceStart, ChatEventTypeUserRemoved, ChatEventTypeUserStatusChange, ChatEventTypeUserSuggestedActionSelected, ChatEventTypeUserSuggestedActions, ChatEventTypeWaiting, ChatEventTypeWaitingForAgent, type ChatFlow, type ChatGrading, type ChatMessage, type ChatMessageError, type ChatProductReference, type ChatQueueInfo, type ChatRateLimits, type ChatRole, ChatRoleAI, ChatRoleDataQuery, ChatRoleEvent, ChatRoleHumanAgent, ChatRoleObserver, ChatRoleSystem, type ChatRoleTS, ChatRoleTool, ChatRoleUser, type ChatSession, type ChatSessionPreferences, type ChatSessionStatus, ChatSessionStatusActive, ChatSessionStatusExpired, ChatSessionStatusIdle, type ChatStatus, ChatStatusAbandoned, ChatStatusActive, ChatStatusArchived, ChatStatusClosed, ChatStatusCompleted, ChatStatusDisconnected, type ChatStatusTS, type ChatStatusUpdate, type ChatSummary, type ChatTool, type ChatType, ChatTypeCustomerSupport, ChatTypeDirect, ChatTypeGroup, ChatTypePrivateRoom, ChatTypePublicRoom, type ChatTypeTS, type ChatUser, CloseAndDeleteChatSubject, type CloseChatRequest, type CloseChatResponse, type CompleteChatByAgentRequest, type CompleteChatByAgentResponse, CompleteChatByAgentSubject, type CreateAgentQueueRequest, type CreateAgentQueueResponse, CreateAgentQueueSubject, type DeleteAgentQueueRequest, type DeleteAgentQueueResponse, DeleteAgentQueueSubject, type DocumentSource, type EmojiReaction, type EndAgentSessionRequest, type EndAgentSessionResponse, EndAgentSessionSubject, type GetActiveChatCountRequest, type GetActiveChatCountResponse, GetActiveChatCountSubject, type GetActiveChatsRequest, type GetActiveChatsResponse, GetActiveChatsSubject, type GetAgentContextRequest, type GetAgentContextResponse, GetAgentContextSubject, type GetAgentQueuesFilter, type GetAgentQueuesRequest, type GetAgentQueuesResponse, GetAgentQueuesSubject, type GetAgentSessionRequest, type GetAgentSessionResponse, GetAgentSessionSubject, type GetChatRequest, type GetChatResponse, GetChatSubject, type GetDailyChatCountRequest, type GetDailyChatCountResponse, GetDailyChatCountSubject, type GetOnlineAgentCountRequest, type GetOnlineAgentCountResponse, GetOnlineAgentCountSubject, type GetOnlineAgentsRequest, type GetOnlineAgentsResponse, GetOnlineAgentsSubject, type GetOnlineUsersRequest, type GetOnlineUsersResponse, GetOnlineUsersSubject, type GetQueueChatCountRequest, type GetQueueChatCountResponse, GetQueueChatCountSubject, type GetQueueChatsRequest, type GetQueueChatsResponse, GetQueueChatsSubject, type GetUserChatsRequest, type GetUserChatsResponse, GetUserChatsSubject, type GetWaitingForAgentChatCountRequest, type GetWaitingForAgentChatCountResponse, GetWaitingForAgentChatCountSubject, type GetWaitingForAgentChatsRequest, type GetWaitingForAgentChatsResponse, GetWaitingForAgentChatsSubject, type LLMConfig, type LLMFunction, type LLMMemoryConfig, type LLMResponse, type LLMTool, type LLMUsage, type ListIdleChatsRequest, type ListIdleChatsResponse, ListIdleChatsSubject, type Location, MarkChatClosedSubject, type MemoryContact, type MemoryNote, type MemoryProfile, type MessageStatus, MessageStatusDelivered, MessageStatusFailed, MessageStatusRead, MessageStatusSending, MessageStatusSent, type MessageStatusTS, type QueueType, QueueTypeComplexity, QueueTypeDepartment, type QueueTypeOptionTS, QueueTypePriority, QueueTypeSkill, type QueueTypeTS, QueueTypes, type RetryAttachmentData, SetupOrgSubject, type StartAgentSessionRequest, type StartAgentSessionResponse, StartAgentSessionSubject, type SummarizeChatResponse, type ToolCall, type TriggerAnalyticsScanRequest, type TriggerAnalyticsScanResponse, TriggerAnalyticsScanSubject, TriggerMemorySummarizationSubject, type UpdateAgentLastActivityRequest, type UpdateAgentLastActivityResponse, UpdateAgentLastActivitySubject, type UpdateAgentQueueRequest, type UpdateAgentQueueResponse, UpdateAgentQueueSubject, type UpdateAgentStatusRequest, type UpdateAgentStatusResponse, UpdateAgentStatusSubject, type UpdateUserStatusRequest, type UpdateUserStatusResponse, UpdateUserStatusSubject, type UserSession, type UserStatus, UserStatusAway, UserStatusBusy, UserStatusOffline, UserStatusOnline, type UserStatusTS };
@@ -128,6 +128,7 @@ __export(models_exports, {
128
128
  ChatEventTypeSyncMetadataResponse: () => ChatEventTypeSyncMetadataResponse,
129
129
  ChatEventTypeSyncUserSession: () => ChatEventTypeSyncUserSession,
130
130
  ChatEventTypeSyncUserSessionResponse: () => ChatEventTypeSyncUserSessionResponse,
131
+ ChatEventTypeTransportReconnected: () => ChatEventTypeTransportReconnected,
131
132
  ChatEventTypeTyping: () => ChatEventTypeTyping,
132
133
  ChatEventTypeUpdateRoom: () => ChatEventTypeUpdateRoom,
133
134
  ChatEventTypeUserActivity: () => ChatEventTypeUserActivity,
@@ -166,6 +167,7 @@ __export(models_exports, {
166
167
  ChatTypeGroup: () => ChatTypeGroup,
167
168
  ChatTypePrivateRoom: () => ChatTypePrivateRoom,
168
169
  ChatTypePublicRoom: () => ChatTypePublicRoom,
170
+ CloseAndDeleteChatSubject: () => CloseAndDeleteChatSubject,
169
171
  CompleteChatByAgentSubject: () => CompleteChatByAgentSubject,
170
172
  CreateAgentQueueSubject: () => CreateAgentQueueSubject,
171
173
  DeleteAgentQueueSubject: () => DeleteAgentQueueSubject,
@@ -185,6 +187,8 @@ __export(models_exports, {
185
187
  GetUserChatsSubject: () => GetUserChatsSubject,
186
188
  GetWaitingForAgentChatCountSubject: () => GetWaitingForAgentChatCountSubject,
187
189
  GetWaitingForAgentChatsSubject: () => GetWaitingForAgentChatsSubject,
190
+ ListIdleChatsSubject: () => ListIdleChatsSubject,
191
+ MarkChatClosedSubject: () => MarkChatClosedSubject,
188
192
  MessageStatusDelivered: () => MessageStatusDelivered,
189
193
  MessageStatusFailed: () => MessageStatusFailed,
190
194
  MessageStatusRead: () => MessageStatusRead,
@@ -198,6 +202,7 @@ __export(models_exports, {
198
202
  SetupOrgSubject: () => SetupOrgSubject,
199
203
  StartAgentSessionSubject: () => StartAgentSessionSubject,
200
204
  TriggerAnalyticsScanSubject: () => TriggerAnalyticsScanSubject,
205
+ TriggerMemorySummarizationSubject: () => TriggerMemorySummarizationSubject,
201
206
  UpdateAgentLastActivitySubject: () => UpdateAgentLastActivitySubject,
202
207
  UpdateAgentQueueSubject: () => UpdateAgentQueueSubject,
203
208
  UpdateAgentStatusSubject: () => UpdateAgentStatusSubject,
@@ -240,6 +245,7 @@ var ChatEventTypeStoppedTyping = "stopped_typing";
240
245
  var ChatEventTypeRead = "read";
241
246
  var ChatEventTypeDelivered = "delivered";
242
247
  var ChatEventTypeReconnected = "reconnected";
248
+ var ChatEventTypeTransportReconnected = "transport_reconnected";
243
249
  var ChatEventTypeError = "error";
244
250
  var ChatEventTypeWaiting = "waiting";
245
251
  var ChatEventTypeLoadChat = "load_chat";
@@ -379,6 +385,9 @@ var GetActiveChatsSubject = "chat.get_active_chats";
379
385
  var GetUserChatsSubject = "chat.get_user_chats";
380
386
  var GetChatSubject = "chat.get_chat";
381
387
  var ChatArchiveSubjectPattern = "chat.archive.%s.server";
388
+ var ListIdleChatsSubject = "chat.maintenance.list_idle_chats";
389
+ var CloseAndDeleteChatSubject = "chat.maintenance.close_and_delete_chat";
390
+ var MarkChatClosedSubject = "chat.maintenance.mark_closed";
382
391
  var StartAgentSessionSubject = "chat.agent_session.start";
383
392
  var EndAgentSessionSubject = "chat.agent_session.end";
384
393
  var UpdateAgentStatusSubject = "chat.agent_session.update_status";
@@ -400,6 +409,7 @@ var GetOnlineUsersSubject = "chat.users.online.get";
400
409
  var TriggerAnalyticsScanSubject = "chat.analytics.trigger-scan";
401
410
  var SetupOrgSubject = "chat.org.setup";
402
411
  var GetAgentContextSubject = "chat.agent-context.get";
412
+ var TriggerMemorySummarizationSubject = "chat.memory.summarize.nightly";
403
413
  // Annotate the CommonJS export names for ESM import in node:
404
414
  0 && (module.exports = {
405
415
  AgentStatusAway,
@@ -509,6 +519,7 @@ var GetAgentContextSubject = "chat.agent-context.get";
509
519
  ChatEventTypeSyncMetadataResponse,
510
520
  ChatEventTypeSyncUserSession,
511
521
  ChatEventTypeSyncUserSessionResponse,
522
+ ChatEventTypeTransportReconnected,
512
523
  ChatEventTypeTyping,
513
524
  ChatEventTypeUpdateRoom,
514
525
  ChatEventTypeUserActivity,
@@ -547,6 +558,7 @@ var GetAgentContextSubject = "chat.agent-context.get";
547
558
  ChatTypeGroup,
548
559
  ChatTypePrivateRoom,
549
560
  ChatTypePublicRoom,
561
+ CloseAndDeleteChatSubject,
550
562
  CompleteChatByAgentSubject,
551
563
  CreateAgentQueueSubject,
552
564
  DeleteAgentQueueSubject,
@@ -566,6 +578,8 @@ var GetAgentContextSubject = "chat.agent-context.get";
566
578
  GetUserChatsSubject,
567
579
  GetWaitingForAgentChatCountSubject,
568
580
  GetWaitingForAgentChatsSubject,
581
+ ListIdleChatsSubject,
582
+ MarkChatClosedSubject,
569
583
  MessageStatusDelivered,
570
584
  MessageStatusFailed,
571
585
  MessageStatusRead,
@@ -579,6 +593,7 @@ var GetAgentContextSubject = "chat.agent-context.get";
579
593
  SetupOrgSubject,
580
594
  StartAgentSessionSubject,
581
595
  TriggerAnalyticsScanSubject,
596
+ TriggerMemorySummarizationSubject,
582
597
  UpdateAgentLastActivitySubject,
583
598
  UpdateAgentQueueSubject,
584
599
  UpdateAgentStatusSubject,