@cimulate/copilot-sdk 3.8.0 → 3.9.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.
@@ -0,0 +1,8 @@
1
+ interface ConversationEvents {
2
+ conversationId: string;
3
+ limit?: number;
4
+ since?: string;
5
+ includeEvents?: string[];
6
+ excludeEvents?: string[];
7
+ }
8
+ export { ConversationEvents };
@@ -7,6 +7,7 @@ export * from './CommonRequiredFields';
7
7
  export * from './ConnectAck';
8
8
  export * from './ConnectAckMetadata';
9
9
  export * from './ConnectError';
10
+ export * from './ConversationEvents';
10
11
  export * from './ConversationReset';
11
12
  export * from './ConversationResetAck';
12
13
  export * from './CopilotApiAck';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cimulate/copilot-sdk",
3
- "version": "3.8.0",
3
+ "version": "3.9.0",
4
4
  "description": "A lightweight API client SDK for Cimulate Copilot",
5
5
  "files": [
6
6
  "dist/**",
package/src/copilot.ts CHANGED
@@ -9,7 +9,9 @@ import type {
9
9
  CopilotBrowse,
10
10
  CopilotBrowseAck,
11
11
  ConnectError,
12
+ ConversationEvents,
12
13
  CopilotAPIEvent,
14
+ CopilotEvent,
13
15
  CopilotEventName,
14
16
  CopilotSearch,
15
17
  CopilotSearchAck,
@@ -38,6 +40,7 @@ interface CommonOptions {
38
40
  }
39
41
 
40
42
  type CimulateCopilotOptions = (ApiKeyAuth | ApiTokenAuth) & CommonOptions;
43
+ type CopilotEvents = CopilotEvent[]
41
44
 
42
45
  const socketDefaults: SocketIOOptions = {
43
46
  path: "/api/v1/socket.io",
@@ -328,6 +331,26 @@ export default class CimulateCopilot<
328
331
  });
329
332
  }
330
333
 
334
+ async getConversationEvents(
335
+ args: ConversationEvents
336
+ ): Promise<CopilotEvents>;
337
+ async getConversationEvents(
338
+ args: ConversationEvents,
339
+ callback?: (events: CopilotEvents) => void
340
+ ): Promise<void>;
341
+ async getConversationEvents(
342
+ args: ConversationEvents,
343
+ callback?: (events: CopilotEvents) => void
344
+ ): Promise<CopilotEvents | void> {
345
+ return new Promise((resolve) => {
346
+ this.socket.emit("conversation_events", args, (response: CopilotEvents) => {
347
+ if (callback) callback(response);
348
+ // TODO - error handling
349
+ resolve(response as CopilotEvents);
350
+ });
351
+ });
352
+ }
353
+
331
354
  on<E extends CopilotEventName>(
332
355
  name: E,
333
356
  handler: (event: Extract<CopilotAPIEvent<T>, { name: E }>) => void
@@ -0,0 +1,9 @@
1
+
2
+ interface ConversationEvents {
3
+ conversationId: string;
4
+ limit?: number;
5
+ since?: string;
6
+ includeEvents?: string[];
7
+ excludeEvents?: string[];
8
+ }
9
+ export { ConversationEvents };
@@ -7,6 +7,7 @@ export * from './CommonRequiredFields';
7
7
  export * from './ConnectAck';
8
8
  export * from './ConnectAckMetadata';
9
9
  export * from './ConnectError';
10
+ export * from './ConversationEvents';
10
11
  export * from './ConversationReset';
11
12
  export * from './ConversationResetAck';
12
13
  export * from './CopilotApiAck';