@uptiqai/widgets-sdk 1.276.0 → 1.277.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/dist/index.d.ts CHANGED
@@ -212,6 +212,17 @@ export declare type ConversationListItem = {
212
212
  updatedAt: Date;
213
213
  };
214
214
 
215
+ export declare type ConversationSummaryEvent = {
216
+ conversationId: string;
217
+ status: 'Completed' | 'Failed';
218
+ summary?: string;
219
+ };
220
+
221
+ /** Summarizes a conversation that is still running, so its work can be carried into a fresh one. */
222
+ export declare type ConversationSummaryPayload = {
223
+ conversationId: string;
224
+ };
225
+
215
226
  export declare const createHeadlessAgentInstance: (params: CreateHeadlessAgentInstanceParams) => HeadlessAgentInstance;
216
227
 
217
228
  export declare type CreateHeadlessAgentInstanceParams = Pick<CreateWidgetInstanceParams, 'config' | 'user' | 'instanceId'>;
@@ -309,7 +320,7 @@ export declare type GetConversationsResult = {
309
320
  };
310
321
 
311
322
  export declare type HeadlessAgentInstance = {
312
- emit: (event: 'query', payload: QueryPayload) => void;
323
+ emit: <T extends HeadlessEmitType>(event: T, payload: HeadlessEmitPayload<T>) => void;
313
324
  on: <T extends HeadlessEventType>(event: T, handler: HeadlessEventHandler<T>) => () => void;
314
325
  /** Attach to a conversation's live element stream without sending on it. Returns its own unsubscribe. */
315
326
  subscribeToConversation: (conversationId: string) => () => void;
@@ -318,9 +329,13 @@ export declare type HeadlessAgentInstance = {
318
329
  listConversations: (params?: ListConversationsParams) => Promise<GetConversationsResult>;
319
330
  };
320
331
 
321
- declare type HeadlessEventHandler<T extends HeadlessEventType> = T extends 'agent-interrupt' ? (message: AgentInterruptEvent) => void : T extends 'queue-update' ? (event: QueueUpdateEvent) => void : never;
332
+ declare type HeadlessEmitPayload<T extends HeadlessEmitType> = T extends 'query' ? QueryPayload : ConversationSummaryPayload;
333
+
334
+ declare type HeadlessEmitType = 'query' | 'summarize-conversation' | 'cancel-conversation-summary';
335
+
336
+ declare type HeadlessEventHandler<T extends HeadlessEventType> = T extends 'agent-interrupt' ? (message: AgentInterruptEvent) => void : T extends 'queue-update' ? (event: QueueUpdateEvent) => void : T extends 'conversation-summary' ? (event: ConversationSummaryEvent) => void : never;
322
337
 
323
- export declare type HeadlessEventType = 'agent-interrupt' | 'queue-update';
338
+ export declare type HeadlessEventType = 'agent-interrupt' | 'queue-update' | 'conversation-summary';
324
339
 
325
340
  declare type IntegrationServiceId = 'twilio-whatsapp' | 'resend' | 'stripe' | 'redtail';
326
341