@elelem/answer-engine-client 1.0.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,65 @@
1
+ interface SDKConfig {
2
+ projectID: string;
3
+ environmentID: string;
4
+ userID?: string;
5
+ userTimezone?: string;
6
+ socketUrl?: string;
7
+ socketPath?: string;
8
+ }
9
+ interface Recommendation {
10
+ doc_title: string;
11
+ chunks: string;
12
+ url: string;
13
+ doc_title2?: string;
14
+ chunks2?: string;
15
+ url2?: string;
16
+ }
17
+ type ConnectionStatus = "disconnected" | "connecting" | "connected" | "ready";
18
+ declare class AnswerEngineClient {
19
+ private config;
20
+ private socket;
21
+ private userID;
22
+ private lastReceivedAt;
23
+ private status;
24
+ private activeMessageID;
25
+ private launchMessageID;
26
+ private actionQueue;
27
+ private isProcessingQueue;
28
+ private tokenCallbacks;
29
+ private recommendationCallbacks;
30
+ private statusCallbacks;
31
+ private errorCallbacks;
32
+ constructor(config: SDKConfig);
33
+ /**
34
+ * Initialize the Socket.IO connection and handshakes.
35
+ */
36
+ connect(): Promise<void>;
37
+ /**
38
+ * Terminate the connection.
39
+ */
40
+ disconnect(): void;
41
+ /**
42
+ * Launch/initialize the conversational flow.
43
+ */
44
+ launch(): Promise<void>;
45
+ /**
46
+ * Send a text message turn.
47
+ */
48
+ sendMessage(text: string): Promise<void>;
49
+ /**
50
+ * Trigger a named flow intent event turn.
51
+ */
52
+ sendIntent(intentName: string, data?: Record<string, any>): Promise<void>;
53
+ onToken(callback: (token: string) => void): () => void;
54
+ onRecommendations(callback: (rec: Recommendation) => void): () => void;
55
+ onStatusChange(callback: (status: ConnectionStatus) => void): () => void;
56
+ onError(callback: (error: Error) => void): () => void;
57
+ private queueAction;
58
+ private processNextInQueue;
59
+ private updateStatus;
60
+ private handleError;
61
+ private triggerToken;
62
+ private triggerRecommendation;
63
+ }
64
+
65
+ export { AnswerEngineClient, type ConnectionStatus, type Recommendation, type SDKConfig };
@@ -0,0 +1,65 @@
1
+ interface SDKConfig {
2
+ projectID: string;
3
+ environmentID: string;
4
+ userID?: string;
5
+ userTimezone?: string;
6
+ socketUrl?: string;
7
+ socketPath?: string;
8
+ }
9
+ interface Recommendation {
10
+ doc_title: string;
11
+ chunks: string;
12
+ url: string;
13
+ doc_title2?: string;
14
+ chunks2?: string;
15
+ url2?: string;
16
+ }
17
+ type ConnectionStatus = "disconnected" | "connecting" | "connected" | "ready";
18
+ declare class AnswerEngineClient {
19
+ private config;
20
+ private socket;
21
+ private userID;
22
+ private lastReceivedAt;
23
+ private status;
24
+ private activeMessageID;
25
+ private launchMessageID;
26
+ private actionQueue;
27
+ private isProcessingQueue;
28
+ private tokenCallbacks;
29
+ private recommendationCallbacks;
30
+ private statusCallbacks;
31
+ private errorCallbacks;
32
+ constructor(config: SDKConfig);
33
+ /**
34
+ * Initialize the Socket.IO connection and handshakes.
35
+ */
36
+ connect(): Promise<void>;
37
+ /**
38
+ * Terminate the connection.
39
+ */
40
+ disconnect(): void;
41
+ /**
42
+ * Launch/initialize the conversational flow.
43
+ */
44
+ launch(): Promise<void>;
45
+ /**
46
+ * Send a text message turn.
47
+ */
48
+ sendMessage(text: string): Promise<void>;
49
+ /**
50
+ * Trigger a named flow intent event turn.
51
+ */
52
+ sendIntent(intentName: string, data?: Record<string, any>): Promise<void>;
53
+ onToken(callback: (token: string) => void): () => void;
54
+ onRecommendations(callback: (rec: Recommendation) => void): () => void;
55
+ onStatusChange(callback: (status: ConnectionStatus) => void): () => void;
56
+ onError(callback: (error: Error) => void): () => void;
57
+ private queueAction;
58
+ private processNextInQueue;
59
+ private updateStatus;
60
+ private handleError;
61
+ private triggerToken;
62
+ private triggerRecommendation;
63
+ }
64
+
65
+ export { AnswerEngineClient, type ConnectionStatus, type Recommendation, type SDKConfig };