@elqnt/chat 2.0.7 → 3.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.
- package/README.md +386 -0
- package/dist/api/index.d.mts +308 -0
- package/dist/api/index.d.ts +308 -0
- package/dist/api/index.js +220 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/index.mjs +183 -0
- package/dist/api/index.mjs.map +1 -0
- package/dist/hooks/index.d.mts +78 -0
- package/dist/hooks/index.d.ts +78 -0
- package/dist/hooks/index.js +709 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +683 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/index.d.mts +4 -109
- package/dist/index.d.ts +4 -109
- package/dist/index.js +699 -3607
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +690 -3584
- package/dist/index.mjs.map +1 -1
- package/dist/models/index.d.mts +76 -6
- package/dist/models/index.d.ts +76 -6
- package/dist/models/index.js +21 -0
- package/dist/models/index.js.map +1 -1
- package/dist/models/index.mjs +14 -0
- package/dist/models/index.mjs.map +1 -1
- package/dist/transport/index.d.mts +243 -0
- package/dist/transport/index.d.ts +243 -0
- package/dist/transport/index.js +875 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/transport/index.mjs +843 -0
- package/dist/transport/index.mjs.map +1 -0
- package/dist/types-BB5nRdZs.d.mts +222 -0
- package/dist/types-CNvuxtcv.d.ts +222 -0
- package/package.json +32 -40
- package/dist/hooks/use-websocket-chat-admin.d.mts +0 -17
- package/dist/hooks/use-websocket-chat-admin.d.ts +0 -17
- package/dist/hooks/use-websocket-chat-admin.js +0 -1196
- package/dist/hooks/use-websocket-chat-admin.js.map +0 -1
- package/dist/hooks/use-websocket-chat-admin.mjs +0 -1172
- package/dist/hooks/use-websocket-chat-admin.mjs.map +0 -1
- package/dist/hooks/use-websocket-chat-base.d.mts +0 -81
- package/dist/hooks/use-websocket-chat-base.d.ts +0 -81
- package/dist/hooks/use-websocket-chat-base.js +0 -1025
- package/dist/hooks/use-websocket-chat-base.js.map +0 -1
- package/dist/hooks/use-websocket-chat-base.mjs +0 -1001
- package/dist/hooks/use-websocket-chat-base.mjs.map +0 -1
- package/dist/hooks/use-websocket-chat-customer.d.mts +0 -24
- package/dist/hooks/use-websocket-chat-customer.d.ts +0 -24
- package/dist/hooks/use-websocket-chat-customer.js +0 -1092
- package/dist/hooks/use-websocket-chat-customer.js.map +0 -1
- package/dist/hooks/use-websocket-chat-customer.mjs +0 -1068
- package/dist/hooks/use-websocket-chat-customer.mjs.map +0 -1
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { ApiClientOptions, ApiResponse } from '@elqnt/api-client';
|
|
2
|
+
import { ResponseMetadata } from '@elqnt/types';
|
|
3
|
+
import { Chat, ChatSummary } from '../models/index.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Stream API
|
|
7
|
+
*
|
|
8
|
+
* Low-level functions for chat streaming operations.
|
|
9
|
+
* These are used internally by the transport layer but can also
|
|
10
|
+
* be used directly for custom implementations.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { createChat, sendChatMessage, loadChat } from "@elqnt/chat/api";
|
|
15
|
+
*
|
|
16
|
+
* // Create a new chat
|
|
17
|
+
* const chatKey = await createChat({
|
|
18
|
+
* baseUrl: "https://api.example.com/chat",
|
|
19
|
+
* orgId: "org-123",
|
|
20
|
+
* userId: "user-456",
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* // Send a message
|
|
24
|
+
* await sendChatMessage({
|
|
25
|
+
* baseUrl: "https://api.example.com/chat",
|
|
26
|
+
* orgId: "org-123",
|
|
27
|
+
* chatKey,
|
|
28
|
+
* userId: "user-456",
|
|
29
|
+
* content: "Hello!",
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Base options for all stream API calls
|
|
36
|
+
*/
|
|
37
|
+
interface StreamApiOptions {
|
|
38
|
+
/** Base URL for the chat server */
|
|
39
|
+
baseUrl: string;
|
|
40
|
+
/** Organization ID */
|
|
41
|
+
orgId: string;
|
|
42
|
+
/** User ID */
|
|
43
|
+
userId: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Response from stream API calls
|
|
47
|
+
*/
|
|
48
|
+
interface StreamApiResponse<T = unknown> {
|
|
49
|
+
success: boolean;
|
|
50
|
+
data?: T;
|
|
51
|
+
error?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Create chat options
|
|
55
|
+
*/
|
|
56
|
+
interface CreateChatApiOptions extends StreamApiOptions {
|
|
57
|
+
/** Optional metadata for the new chat */
|
|
58
|
+
metadata?: Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create chat response data
|
|
62
|
+
*/
|
|
63
|
+
interface CreateChatResponseData {
|
|
64
|
+
chatKey: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Send message options
|
|
68
|
+
*/
|
|
69
|
+
interface SendMessageApiOptions extends StreamApiOptions {
|
|
70
|
+
/** Chat key */
|
|
71
|
+
chatKey: string;
|
|
72
|
+
/** Message content */
|
|
73
|
+
content: string;
|
|
74
|
+
/** Optional attachments */
|
|
75
|
+
attachments?: unknown[];
|
|
76
|
+
/** Optional message metadata */
|
|
77
|
+
metadata?: Record<string, unknown>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Load chat options
|
|
81
|
+
*/
|
|
82
|
+
interface LoadChatApiOptions extends StreamApiOptions {
|
|
83
|
+
/** Chat key to load */
|
|
84
|
+
chatKey: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Load chat response data
|
|
88
|
+
*/
|
|
89
|
+
interface LoadChatResponseData {
|
|
90
|
+
chat: Chat;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* End chat options
|
|
94
|
+
*/
|
|
95
|
+
interface EndChatApiOptions extends StreamApiOptions {
|
|
96
|
+
/** Chat key to end */
|
|
97
|
+
chatKey: string;
|
|
98
|
+
/** Optional end reason */
|
|
99
|
+
reason?: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Typing indicator options
|
|
103
|
+
*/
|
|
104
|
+
interface TypingApiOptions extends StreamApiOptions {
|
|
105
|
+
/** Chat key */
|
|
106
|
+
chatKey: string;
|
|
107
|
+
/** Whether user is typing */
|
|
108
|
+
typing: boolean;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Generic event options
|
|
112
|
+
*/
|
|
113
|
+
interface SendEventApiOptions extends StreamApiOptions {
|
|
114
|
+
/** Chat key */
|
|
115
|
+
chatKey: string;
|
|
116
|
+
/** Event type */
|
|
117
|
+
type: string;
|
|
118
|
+
/** Event data */
|
|
119
|
+
data?: Record<string, unknown>;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Create a new chat session
|
|
123
|
+
*
|
|
124
|
+
* @param options - Create chat options
|
|
125
|
+
* @returns Chat key of the created chat
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* const chatKey = await createChat({
|
|
130
|
+
* baseUrl: "https://api.example.com/chat",
|
|
131
|
+
* orgId: "org-123",
|
|
132
|
+
* userId: "user-456",
|
|
133
|
+
* metadata: { source: "website" },
|
|
134
|
+
* });
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
declare function createChat(options: CreateChatApiOptions): Promise<string>;
|
|
138
|
+
/**
|
|
139
|
+
* Send a message in a chat
|
|
140
|
+
*
|
|
141
|
+
* @param options - Send message options
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```typescript
|
|
145
|
+
* await sendChatMessage({
|
|
146
|
+
* baseUrl: "https://api.example.com/chat",
|
|
147
|
+
* orgId: "org-123",
|
|
148
|
+
* chatKey: "chat-789",
|
|
149
|
+
* userId: "user-456",
|
|
150
|
+
* content: "Hello!",
|
|
151
|
+
* });
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
declare function sendChatMessage(options: SendMessageApiOptions): Promise<void>;
|
|
155
|
+
/**
|
|
156
|
+
* Load an existing chat
|
|
157
|
+
*
|
|
158
|
+
* @param options - Load chat options
|
|
159
|
+
* @returns The loaded chat object
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* const chat = await loadChat({
|
|
164
|
+
* baseUrl: "https://api.example.com/chat",
|
|
165
|
+
* orgId: "org-123",
|
|
166
|
+
* chatKey: "chat-789",
|
|
167
|
+
* userId: "user-456",
|
|
168
|
+
* });
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
declare function loadChat(options: LoadChatApiOptions): Promise<Chat>;
|
|
172
|
+
/**
|
|
173
|
+
* End a chat session
|
|
174
|
+
*
|
|
175
|
+
* @param options - End chat options
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```typescript
|
|
179
|
+
* await endChat({
|
|
180
|
+
* baseUrl: "https://api.example.com/chat",
|
|
181
|
+
* orgId: "org-123",
|
|
182
|
+
* chatKey: "chat-789",
|
|
183
|
+
* userId: "user-456",
|
|
184
|
+
* reason: "User closed chat",
|
|
185
|
+
* });
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
declare function endChat(options: EndChatApiOptions): Promise<void>;
|
|
189
|
+
/**
|
|
190
|
+
* Send typing indicator
|
|
191
|
+
*
|
|
192
|
+
* @param options - Typing indicator options
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* ```typescript
|
|
196
|
+
* // User started typing
|
|
197
|
+
* await sendTypingIndicator({
|
|
198
|
+
* baseUrl: "https://api.example.com/chat",
|
|
199
|
+
* orgId: "org-123",
|
|
200
|
+
* chatKey: "chat-789",
|
|
201
|
+
* userId: "user-456",
|
|
202
|
+
* typing: true,
|
|
203
|
+
* });
|
|
204
|
+
*
|
|
205
|
+
* // User stopped typing
|
|
206
|
+
* await sendTypingIndicator({
|
|
207
|
+
* baseUrl: "https://api.example.com/chat",
|
|
208
|
+
* orgId: "org-123",
|
|
209
|
+
* chatKey: "chat-789",
|
|
210
|
+
* userId: "user-456",
|
|
211
|
+
* typing: false,
|
|
212
|
+
* });
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
declare function sendTypingIndicator(options: TypingApiOptions): Promise<void>;
|
|
216
|
+
/**
|
|
217
|
+
* Send a generic event
|
|
218
|
+
*
|
|
219
|
+
* @param options - Event options
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* await sendEvent({
|
|
224
|
+
* baseUrl: "https://api.example.com/chat",
|
|
225
|
+
* orgId: "org-123",
|
|
226
|
+
* chatKey: "chat-789",
|
|
227
|
+
* userId: "user-456",
|
|
228
|
+
* type: "skill_activate",
|
|
229
|
+
* data: { skillId: "research" },
|
|
230
|
+
* });
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
declare function sendEvent(options: SendEventApiOptions): Promise<void>;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Chat API
|
|
237
|
+
*
|
|
238
|
+
* API functions for chat operations.
|
|
239
|
+
*
|
|
240
|
+
* ## Browser API (uses @elqnt/api-client)
|
|
241
|
+
* ```typescript
|
|
242
|
+
* import { getChatHistoryApi, getChatApi } from "@elqnt/chat/api";
|
|
243
|
+
*
|
|
244
|
+
* const history = await getChatHistoryApi({ baseUrl, orgId, limit: 10 });
|
|
245
|
+
* const chat = await getChatApi(chatKey, { baseUrl, orgId });
|
|
246
|
+
* ```
|
|
247
|
+
*
|
|
248
|
+
* ## Stream API (direct HTTP calls)
|
|
249
|
+
* ```typescript
|
|
250
|
+
* import { createChat, sendChatMessage, loadChat } from "@elqnt/chat/api";
|
|
251
|
+
*
|
|
252
|
+
* const chatKey = await createChat({ baseUrl, orgId, userId });
|
|
253
|
+
* await sendChatMessage({ baseUrl, orgId, chatKey, userId, content: "Hello!" });
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
|
|
257
|
+
interface ChatHistoryResponse {
|
|
258
|
+
chats: ChatSummary[];
|
|
259
|
+
total: number;
|
|
260
|
+
hasMore: boolean;
|
|
261
|
+
metadata: ResponseMetadata;
|
|
262
|
+
}
|
|
263
|
+
interface ChatResponse {
|
|
264
|
+
chat: ChatSummary;
|
|
265
|
+
metadata: ResponseMetadata;
|
|
266
|
+
}
|
|
267
|
+
interface UpdateChatResponse {
|
|
268
|
+
chatKey: string;
|
|
269
|
+
title: string;
|
|
270
|
+
pinned: boolean;
|
|
271
|
+
metadata: ResponseMetadata;
|
|
272
|
+
}
|
|
273
|
+
interface ActiveChatsResponse {
|
|
274
|
+
chats: ChatSummary[];
|
|
275
|
+
metadata: ResponseMetadata;
|
|
276
|
+
}
|
|
277
|
+
interface ActiveChatsCountResponse {
|
|
278
|
+
count: number;
|
|
279
|
+
metadata: ResponseMetadata;
|
|
280
|
+
}
|
|
281
|
+
declare function getChatHistoryApi(options: ApiClientOptions & {
|
|
282
|
+
limit?: number;
|
|
283
|
+
offset?: number;
|
|
284
|
+
skipCache?: boolean;
|
|
285
|
+
}): Promise<ApiResponse<ChatHistoryResponse>>;
|
|
286
|
+
declare function getChatApi(chatKey: string, options: ApiClientOptions): Promise<ApiResponse<ChatResponse>>;
|
|
287
|
+
declare function updateChatApi(chatKey: string, updates: {
|
|
288
|
+
title?: string;
|
|
289
|
+
pinned?: boolean;
|
|
290
|
+
}, options: ApiClientOptions): Promise<ApiResponse<UpdateChatResponse>>;
|
|
291
|
+
declare function deleteChatApi(chatKey: string, options: ApiClientOptions): Promise<ApiResponse<{
|
|
292
|
+
success: boolean;
|
|
293
|
+
metadata: ResponseMetadata;
|
|
294
|
+
}>>;
|
|
295
|
+
declare function getActiveChatsCountApi(options: ApiClientOptions): Promise<ApiResponse<ActiveChatsCountResponse>>;
|
|
296
|
+
declare function getActiveChatsApi(options: ApiClientOptions & {
|
|
297
|
+
pastHours?: number;
|
|
298
|
+
}): Promise<ApiResponse<ActiveChatsResponse>>;
|
|
299
|
+
declare function updateProjectChatTitleApi(projectId: string, chatKey: string, title: string, options: ApiClientOptions): Promise<ApiResponse<{
|
|
300
|
+
success: boolean;
|
|
301
|
+
metadata: ResponseMetadata;
|
|
302
|
+
}>>;
|
|
303
|
+
declare function addChatToProjectApi(projectId: string, chatKey: string, options: ApiClientOptions): Promise<ApiResponse<{
|
|
304
|
+
success: boolean;
|
|
305
|
+
metadata: ResponseMetadata;
|
|
306
|
+
}>>;
|
|
307
|
+
|
|
308
|
+
export { type ActiveChatsCountResponse, type ActiveChatsResponse, Chat, type ChatHistoryResponse, type ChatResponse, ChatSummary, type CreateChatApiOptions, type CreateChatResponseData, type EndChatApiOptions, type LoadChatApiOptions, type LoadChatResponseData, type SendEventApiOptions, type SendMessageApiOptions, type StreamApiOptions, type StreamApiResponse, type TypingApiOptions, type UpdateChatResponse, addChatToProjectApi, createChat, deleteChatApi, endChat, getActiveChatsApi, getActiveChatsCountApi, getChatApi, getChatHistoryApi, loadChat, sendChatMessage, sendEvent, sendTypingIndicator, updateChatApi, updateProjectChatTitleApi };
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// api/index.ts
|
|
22
|
+
var api_exports = {};
|
|
23
|
+
__export(api_exports, {
|
|
24
|
+
addChatToProjectApi: () => addChatToProjectApi,
|
|
25
|
+
createChat: () => createChat,
|
|
26
|
+
deleteChatApi: () => deleteChatApi,
|
|
27
|
+
endChat: () => endChat,
|
|
28
|
+
getActiveChatsApi: () => getActiveChatsApi,
|
|
29
|
+
getActiveChatsCountApi: () => getActiveChatsCountApi,
|
|
30
|
+
getChatApi: () => getChatApi,
|
|
31
|
+
getChatHistoryApi: () => getChatHistoryApi,
|
|
32
|
+
loadChat: () => loadChat,
|
|
33
|
+
sendChatMessage: () => sendChatMessage,
|
|
34
|
+
sendEvent: () => sendEvent,
|
|
35
|
+
sendTypingIndicator: () => sendTypingIndicator,
|
|
36
|
+
updateChatApi: () => updateChatApi,
|
|
37
|
+
updateProjectChatTitleApi: () => updateProjectChatTitleApi
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(api_exports);
|
|
40
|
+
var import_browser = require("@elqnt/api-client/browser");
|
|
41
|
+
|
|
42
|
+
// api/stream-api.ts
|
|
43
|
+
async function streamFetch(url, body) {
|
|
44
|
+
const response = await fetch(url, {
|
|
45
|
+
method: "POST",
|
|
46
|
+
headers: { "Content-Type": "application/json" },
|
|
47
|
+
body: JSON.stringify(body)
|
|
48
|
+
});
|
|
49
|
+
if (!response.ok) {
|
|
50
|
+
const errorText = await response.text();
|
|
51
|
+
return {
|
|
52
|
+
success: false,
|
|
53
|
+
error: `API error: ${response.status} - ${errorText}`
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const data = await response.json();
|
|
57
|
+
return { success: true, data };
|
|
58
|
+
}
|
|
59
|
+
async function createChat(options) {
|
|
60
|
+
const { baseUrl, orgId, userId, metadata } = options;
|
|
61
|
+
const result = await streamFetch(
|
|
62
|
+
`${baseUrl}/create`,
|
|
63
|
+
{ orgId, userId, metadata }
|
|
64
|
+
);
|
|
65
|
+
if (!result.success || !result.data?.chatKey) {
|
|
66
|
+
throw new Error(result.error || "Failed to create chat");
|
|
67
|
+
}
|
|
68
|
+
return result.data.chatKey;
|
|
69
|
+
}
|
|
70
|
+
async function sendChatMessage(options) {
|
|
71
|
+
const { baseUrl, orgId, chatKey, userId, content, attachments, metadata } = options;
|
|
72
|
+
const message = {
|
|
73
|
+
id: `msg_${Date.now()}_${Math.random().toString(36).slice(2)}`,
|
|
74
|
+
role: "user",
|
|
75
|
+
content,
|
|
76
|
+
time: Date.now(),
|
|
77
|
+
status: "sending",
|
|
78
|
+
senderId: userId,
|
|
79
|
+
createdAt: Date.now(),
|
|
80
|
+
attachments
|
|
81
|
+
};
|
|
82
|
+
const result = await streamFetch(`${baseUrl}/send`, {
|
|
83
|
+
orgId,
|
|
84
|
+
chatKey,
|
|
85
|
+
userId,
|
|
86
|
+
message,
|
|
87
|
+
metadata
|
|
88
|
+
});
|
|
89
|
+
if (!result.success) {
|
|
90
|
+
throw new Error(result.error || "Failed to send message");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async function loadChat(options) {
|
|
94
|
+
const { baseUrl, orgId, chatKey, userId } = options;
|
|
95
|
+
const result = await streamFetch(`${baseUrl}/load`, {
|
|
96
|
+
orgId,
|
|
97
|
+
chatKey,
|
|
98
|
+
userId
|
|
99
|
+
});
|
|
100
|
+
if (!result.success || !result.data?.chat) {
|
|
101
|
+
throw new Error(result.error || "Failed to load chat");
|
|
102
|
+
}
|
|
103
|
+
return result.data.chat;
|
|
104
|
+
}
|
|
105
|
+
async function endChat(options) {
|
|
106
|
+
const { baseUrl, orgId, chatKey, userId, reason } = options;
|
|
107
|
+
const result = await streamFetch(`${baseUrl}/end`, {
|
|
108
|
+
orgId,
|
|
109
|
+
chatKey,
|
|
110
|
+
userId,
|
|
111
|
+
data: reason ? { reason } : void 0
|
|
112
|
+
});
|
|
113
|
+
if (!result.success) {
|
|
114
|
+
throw new Error(result.error || "Failed to end chat");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async function sendTypingIndicator(options) {
|
|
118
|
+
const { baseUrl, orgId, chatKey, userId, typing } = options;
|
|
119
|
+
const result = await streamFetch(`${baseUrl}/typing`, {
|
|
120
|
+
orgId,
|
|
121
|
+
chatKey,
|
|
122
|
+
userId,
|
|
123
|
+
typing
|
|
124
|
+
});
|
|
125
|
+
if (!result.success) {
|
|
126
|
+
throw new Error(result.error || "Failed to send typing indicator");
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async function sendEvent(options) {
|
|
130
|
+
const { baseUrl, orgId, chatKey, userId, type, data } = options;
|
|
131
|
+
const result = await streamFetch(`${baseUrl}/event`, {
|
|
132
|
+
type,
|
|
133
|
+
orgId,
|
|
134
|
+
chatKey,
|
|
135
|
+
userId,
|
|
136
|
+
data
|
|
137
|
+
});
|
|
138
|
+
if (!result.success) {
|
|
139
|
+
throw new Error(result.error || "Failed to send event");
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// api/index.ts
|
|
144
|
+
async function getChatHistoryApi(options) {
|
|
145
|
+
return (0, import_browser.browserApiRequest)("/api/v1/chats", {
|
|
146
|
+
method: "POST",
|
|
147
|
+
body: {
|
|
148
|
+
limit: options.limit || 15,
|
|
149
|
+
offset: options.offset || 0,
|
|
150
|
+
...options.skipCache ? { skipCache: true } : {}
|
|
151
|
+
},
|
|
152
|
+
...options
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
async function getChatApi(chatKey, options) {
|
|
156
|
+
return (0, import_browser.browserApiRequest)(`/api/v1/chats/${chatKey}`, {
|
|
157
|
+
method: "GET",
|
|
158
|
+
...options
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
async function updateChatApi(chatKey, updates, options) {
|
|
162
|
+
return (0, import_browser.browserApiRequest)(`/api/v1/chats/${chatKey}`, {
|
|
163
|
+
method: "PATCH",
|
|
164
|
+
body: updates,
|
|
165
|
+
...options
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
async function deleteChatApi(chatKey, options) {
|
|
169
|
+
return (0, import_browser.browserApiRequest)(`/api/v1/chats/${chatKey}`, {
|
|
170
|
+
method: "DELETE",
|
|
171
|
+
...options
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
async function getActiveChatsCountApi(options) {
|
|
175
|
+
return (0, import_browser.browserApiRequest)("/api/v1/chats/active/count", {
|
|
176
|
+
method: "GET",
|
|
177
|
+
...options
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
async function getActiveChatsApi(options) {
|
|
181
|
+
const params = new URLSearchParams();
|
|
182
|
+
if (options.pastHours) params.set("pastHours", String(options.pastHours));
|
|
183
|
+
const queryString = params.toString();
|
|
184
|
+
return (0, import_browser.browserApiRequest)(`/api/v1/chats/active${queryString ? `?${queryString}` : ""}`, {
|
|
185
|
+
method: "GET",
|
|
186
|
+
...options
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
async function updateProjectChatTitleApi(projectId, chatKey, title, options) {
|
|
190
|
+
return (0, import_browser.browserApiRequest)(`/api/v1/projects/${projectId}/chats/${chatKey}/title`, {
|
|
191
|
+
method: "PUT",
|
|
192
|
+
body: { title },
|
|
193
|
+
...options
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
async function addChatToProjectApi(projectId, chatKey, options) {
|
|
197
|
+
return (0, import_browser.browserApiRequest)(`/api/v1/projects/${projectId}/chats`, {
|
|
198
|
+
method: "POST",
|
|
199
|
+
body: { chatKey },
|
|
200
|
+
...options
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
204
|
+
0 && (module.exports = {
|
|
205
|
+
addChatToProjectApi,
|
|
206
|
+
createChat,
|
|
207
|
+
deleteChatApi,
|
|
208
|
+
endChat,
|
|
209
|
+
getActiveChatsApi,
|
|
210
|
+
getActiveChatsCountApi,
|
|
211
|
+
getChatApi,
|
|
212
|
+
getChatHistoryApi,
|
|
213
|
+
loadChat,
|
|
214
|
+
sendChatMessage,
|
|
215
|
+
sendEvent,
|
|
216
|
+
sendTypingIndicator,
|
|
217
|
+
updateChatApi,
|
|
218
|
+
updateProjectChatTitleApi
|
|
219
|
+
});
|
|
220
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../api/index.ts","../../api/stream-api.ts"],"sourcesContent":["/**\n * Chat API\n *\n * API functions for chat operations.\n *\n * ## Browser API (uses @elqnt/api-client)\n * ```typescript\n * import { getChatHistoryApi, getChatApi } from \"@elqnt/chat/api\";\n *\n * const history = await getChatHistoryApi({ baseUrl, orgId, limit: 10 });\n * const chat = await getChatApi(chatKey, { baseUrl, orgId });\n * ```\n *\n * ## Stream API (direct HTTP calls)\n * ```typescript\n * import { createChat, sendChatMessage, loadChat } from \"@elqnt/chat/api\";\n *\n * const chatKey = await createChat({ baseUrl, orgId, userId });\n * await sendChatMessage({ baseUrl, orgId, chatKey, userId, content: \"Hello!\" });\n * ```\n */\n\nimport { browserApiRequest } from \"@elqnt/api-client/browser\";\nimport type { ApiResponse, ApiClientOptions } from \"@elqnt/api-client\";\nimport type { ResponseMetadata } from \"@elqnt/types\";\nimport type { ChatSummary, Chat } from \"../models\";\n\n// Re-export types from models\nexport type { ChatSummary, Chat } from \"../models\";\n\n// Re-export stream API functions\nexport {\n createChat,\n sendChatMessage,\n loadChat,\n endChat,\n sendTypingIndicator,\n sendEvent,\n} from \"./stream-api\";\n\nexport type {\n StreamApiOptions,\n StreamApiResponse,\n CreateChatApiOptions,\n CreateChatResponseData,\n SendMessageApiOptions,\n LoadChatApiOptions,\n LoadChatResponseData,\n EndChatApiOptions,\n TypingApiOptions,\n SendEventApiOptions,\n} from \"./stream-api\";\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\nexport interface ChatHistoryResponse {\n chats: ChatSummary[];\n total: number;\n hasMore: boolean;\n metadata: ResponseMetadata;\n}\n\nexport interface ChatResponse {\n chat: ChatSummary;\n metadata: ResponseMetadata;\n}\n\nexport interface UpdateChatResponse {\n chatKey: string;\n title: string;\n pinned: boolean;\n metadata: ResponseMetadata;\n}\n\nexport interface ActiveChatsResponse {\n chats: ChatSummary[];\n metadata: ResponseMetadata;\n}\n\nexport interface ActiveChatsCountResponse {\n count: number;\n metadata: ResponseMetadata;\n}\n\n// =============================================================================\n// CHAT HISTORY\n// =============================================================================\n\nexport async function getChatHistoryApi(\n options: ApiClientOptions & { limit?: number; offset?: number; skipCache?: boolean }\n): Promise<ApiResponse<ChatHistoryResponse>> {\n return browserApiRequest(\"/api/v1/chats\", {\n method: \"POST\",\n body: {\n limit: options.limit || 15,\n offset: options.offset || 0,\n ...(options.skipCache ? { skipCache: true } : {}),\n },\n ...options,\n });\n}\n\nexport async function getChatApi(\n chatKey: string,\n options: ApiClientOptions\n): Promise<ApiResponse<ChatResponse>> {\n return browserApiRequest(`/api/v1/chats/${chatKey}`, {\n method: \"GET\",\n ...options,\n });\n}\n\nexport async function updateChatApi(\n chatKey: string,\n updates: { title?: string; pinned?: boolean },\n options: ApiClientOptions\n): Promise<ApiResponse<UpdateChatResponse>> {\n return browserApiRequest(`/api/v1/chats/${chatKey}`, {\n method: \"PATCH\",\n body: updates,\n ...options,\n });\n}\n\nexport async function deleteChatApi(\n chatKey: string,\n options: ApiClientOptions\n): Promise<ApiResponse<{ success: boolean; metadata: ResponseMetadata }>> {\n return browserApiRequest(`/api/v1/chats/${chatKey}`, {\n method: \"DELETE\",\n ...options,\n });\n}\n\n// =============================================================================\n// ACTIVE CHATS\n// =============================================================================\n\nexport async function getActiveChatsCountApi(\n options: ApiClientOptions\n): Promise<ApiResponse<ActiveChatsCountResponse>> {\n return browserApiRequest(\"/api/v1/chats/active/count\", {\n method: \"GET\",\n ...options,\n });\n}\n\nexport async function getActiveChatsApi(\n options: ApiClientOptions & { pastHours?: number }\n): Promise<ApiResponse<ActiveChatsResponse>> {\n const params = new URLSearchParams();\n if (options.pastHours) params.set(\"pastHours\", String(options.pastHours));\n const queryString = params.toString();\n return browserApiRequest(`/api/v1/chats/active${queryString ? `?${queryString}` : \"\"}`, {\n method: \"GET\",\n ...options,\n });\n}\n\n// =============================================================================\n// PROJECT CHATS\n// =============================================================================\n\nexport async function updateProjectChatTitleApi(\n projectId: string,\n chatKey: string,\n title: string,\n options: ApiClientOptions\n): Promise<ApiResponse<{ success: boolean; metadata: ResponseMetadata }>> {\n return browserApiRequest(`/api/v1/projects/${projectId}/chats/${chatKey}/title`, {\n method: \"PUT\",\n body: { title },\n ...options,\n });\n}\n\nexport async function addChatToProjectApi(\n projectId: string,\n chatKey: string,\n options: ApiClientOptions\n): Promise<ApiResponse<{ success: boolean; metadata: ResponseMetadata }>> {\n return browserApiRequest(`/api/v1/projects/${projectId}/chats`, {\n method: \"POST\",\n body: { chatKey },\n ...options,\n });\n}\n","/**\n * Stream API\n *\n * Low-level functions for chat streaming operations.\n * These are used internally by the transport layer but can also\n * be used directly for custom implementations.\n *\n * @example\n * ```typescript\n * import { createChat, sendChatMessage, loadChat } from \"@elqnt/chat/api\";\n *\n * // Create a new chat\n * const chatKey = await createChat({\n * baseUrl: \"https://api.example.com/chat\",\n * orgId: \"org-123\",\n * userId: \"user-456\",\n * });\n *\n * // Send a message\n * await sendChatMessage({\n * baseUrl: \"https://api.example.com/chat\",\n * orgId: \"org-123\",\n * chatKey,\n * userId: \"user-456\",\n * content: \"Hello!\",\n * });\n * ```\n */\n\nimport type { Chat, ChatMessage } from \"../models\";\n\n/**\n * Base options for all stream API calls\n */\nexport interface StreamApiOptions {\n /** Base URL for the chat server */\n baseUrl: string;\n /** Organization ID */\n orgId: string;\n /** User ID */\n userId: string;\n}\n\n/**\n * Response from stream API calls\n */\nexport interface StreamApiResponse<T = unknown> {\n success: boolean;\n data?: T;\n error?: string;\n}\n\n/**\n * Create chat options\n */\nexport interface CreateChatApiOptions extends StreamApiOptions {\n /** Optional metadata for the new chat */\n metadata?: Record<string, unknown>;\n}\n\n/**\n * Create chat response data\n */\nexport interface CreateChatResponseData {\n chatKey: string;\n}\n\n/**\n * Send message options\n */\nexport interface SendMessageApiOptions extends StreamApiOptions {\n /** Chat key */\n chatKey: string;\n /** Message content */\n content: string;\n /** Optional attachments */\n attachments?: unknown[];\n /** Optional message metadata */\n metadata?: Record<string, unknown>;\n}\n\n/**\n * Load chat options\n */\nexport interface LoadChatApiOptions extends StreamApiOptions {\n /** Chat key to load */\n chatKey: string;\n}\n\n/**\n * Load chat response data\n */\nexport interface LoadChatResponseData {\n chat: Chat;\n}\n\n/**\n * End chat options\n */\nexport interface EndChatApiOptions extends StreamApiOptions {\n /** Chat key to end */\n chatKey: string;\n /** Optional end reason */\n reason?: string;\n}\n\n/**\n * Typing indicator options\n */\nexport interface TypingApiOptions extends StreamApiOptions {\n /** Chat key */\n chatKey: string;\n /** Whether user is typing */\n typing: boolean;\n}\n\n/**\n * Generic event options\n */\nexport interface SendEventApiOptions extends StreamApiOptions {\n /** Chat key */\n chatKey: string;\n /** Event type */\n type: string;\n /** Event data */\n data?: Record<string, unknown>;\n}\n\n/**\n * Internal fetch helper\n */\nasync function streamFetch<T>(\n url: string,\n body: Record<string, unknown>\n): Promise<StreamApiResponse<T>> {\n const response = await fetch(url, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(body),\n });\n\n if (!response.ok) {\n const errorText = await response.text();\n return {\n success: false,\n error: `API error: ${response.status} - ${errorText}`,\n };\n }\n\n const data = await response.json();\n return { success: true, data };\n}\n\n/**\n * Create a new chat session\n *\n * @param options - Create chat options\n * @returns Chat key of the created chat\n *\n * @example\n * ```typescript\n * const chatKey = await createChat({\n * baseUrl: \"https://api.example.com/chat\",\n * orgId: \"org-123\",\n * userId: \"user-456\",\n * metadata: { source: \"website\" },\n * });\n * ```\n */\nexport async function createChat(\n options: CreateChatApiOptions\n): Promise<string> {\n const { baseUrl, orgId, userId, metadata } = options;\n\n const result = await streamFetch<CreateChatResponseData>(\n `${baseUrl}/create`,\n { orgId, userId, metadata }\n );\n\n if (!result.success || !result.data?.chatKey) {\n throw new Error(result.error || \"Failed to create chat\");\n }\n\n return result.data.chatKey;\n}\n\n/**\n * Send a message in a chat\n *\n * @param options - Send message options\n *\n * @example\n * ```typescript\n * await sendChatMessage({\n * baseUrl: \"https://api.example.com/chat\",\n * orgId: \"org-123\",\n * chatKey: \"chat-789\",\n * userId: \"user-456\",\n * content: \"Hello!\",\n * });\n * ```\n */\nexport async function sendChatMessage(\n options: SendMessageApiOptions\n): Promise<void> {\n const { baseUrl, orgId, chatKey, userId, content, attachments, metadata } =\n options;\n\n const message: Partial<ChatMessage> = {\n id: `msg_${Date.now()}_${Math.random().toString(36).slice(2)}`,\n role: \"user\",\n content,\n time: Date.now(),\n status: \"sending\",\n senderId: userId,\n createdAt: Date.now(),\n attachments: attachments as ChatMessage[\"attachments\"],\n };\n\n const result = await streamFetch(`${baseUrl}/send`, {\n orgId,\n chatKey,\n userId,\n message,\n metadata,\n });\n\n if (!result.success) {\n throw new Error(result.error || \"Failed to send message\");\n }\n}\n\n/**\n * Load an existing chat\n *\n * @param options - Load chat options\n * @returns The loaded chat object\n *\n * @example\n * ```typescript\n * const chat = await loadChat({\n * baseUrl: \"https://api.example.com/chat\",\n * orgId: \"org-123\",\n * chatKey: \"chat-789\",\n * userId: \"user-456\",\n * });\n * ```\n */\nexport async function loadChat(options: LoadChatApiOptions): Promise<Chat> {\n const { baseUrl, orgId, chatKey, userId } = options;\n\n const result = await streamFetch<LoadChatResponseData>(`${baseUrl}/load`, {\n orgId,\n chatKey,\n userId,\n });\n\n if (!result.success || !result.data?.chat) {\n throw new Error(result.error || \"Failed to load chat\");\n }\n\n return result.data.chat;\n}\n\n/**\n * End a chat session\n *\n * @param options - End chat options\n *\n * @example\n * ```typescript\n * await endChat({\n * baseUrl: \"https://api.example.com/chat\",\n * orgId: \"org-123\",\n * chatKey: \"chat-789\",\n * userId: \"user-456\",\n * reason: \"User closed chat\",\n * });\n * ```\n */\nexport async function endChat(options: EndChatApiOptions): Promise<void> {\n const { baseUrl, orgId, chatKey, userId, reason } = options;\n\n const result = await streamFetch(`${baseUrl}/end`, {\n orgId,\n chatKey,\n userId,\n data: reason ? { reason } : undefined,\n });\n\n if (!result.success) {\n throw new Error(result.error || \"Failed to end chat\");\n }\n}\n\n/**\n * Send typing indicator\n *\n * @param options - Typing indicator options\n *\n * @example\n * ```typescript\n * // User started typing\n * await sendTypingIndicator({\n * baseUrl: \"https://api.example.com/chat\",\n * orgId: \"org-123\",\n * chatKey: \"chat-789\",\n * userId: \"user-456\",\n * typing: true,\n * });\n *\n * // User stopped typing\n * await sendTypingIndicator({\n * baseUrl: \"https://api.example.com/chat\",\n * orgId: \"org-123\",\n * chatKey: \"chat-789\",\n * userId: \"user-456\",\n * typing: false,\n * });\n * ```\n */\nexport async function sendTypingIndicator(\n options: TypingApiOptions\n): Promise<void> {\n const { baseUrl, orgId, chatKey, userId, typing } = options;\n\n const result = await streamFetch(`${baseUrl}/typing`, {\n orgId,\n chatKey,\n userId,\n typing,\n });\n\n if (!result.success) {\n throw new Error(result.error || \"Failed to send typing indicator\");\n }\n}\n\n/**\n * Send a generic event\n *\n * @param options - Event options\n *\n * @example\n * ```typescript\n * await sendEvent({\n * baseUrl: \"https://api.example.com/chat\",\n * orgId: \"org-123\",\n * chatKey: \"chat-789\",\n * userId: \"user-456\",\n * type: \"skill_activate\",\n * data: { skillId: \"research\" },\n * });\n * ```\n */\nexport async function sendEvent(options: SendEventApiOptions): Promise<void> {\n const { baseUrl, orgId, chatKey, userId, type, data } = options;\n\n const result = await streamFetch(`${baseUrl}/event`, {\n type,\n orgId,\n chatKey,\n userId,\n data,\n });\n\n if (!result.success) {\n throw new Error(result.error || \"Failed to send event\");\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBA,qBAAkC;;;AC6GlC,eAAe,YACb,KACA,MAC+B;AAC/B,QAAM,WAAW,MAAM,MAAM,KAAK;AAAA,IAChC,QAAQ;AAAA,IACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,IAC9C,MAAM,KAAK,UAAU,IAAI;AAAA,EAC3B,CAAC;AAED,MAAI,CAAC,SAAS,IAAI;AAChB,UAAM,YAAY,MAAM,SAAS,KAAK;AACtC,WAAO;AAAA,MACL,SAAS;AAAA,MACT,OAAO,cAAc,SAAS,MAAM,MAAM,SAAS;AAAA,IACrD;AAAA,EACF;AAEA,QAAM,OAAO,MAAM,SAAS,KAAK;AACjC,SAAO,EAAE,SAAS,MAAM,KAAK;AAC/B;AAkBA,eAAsB,WACpB,SACiB;AACjB,QAAM,EAAE,SAAS,OAAO,QAAQ,SAAS,IAAI;AAE7C,QAAM,SAAS,MAAM;AAAA,IACnB,GAAG,OAAO;AAAA,IACV,EAAE,OAAO,QAAQ,SAAS;AAAA,EAC5B;AAEA,MAAI,CAAC,OAAO,WAAW,CAAC,OAAO,MAAM,SAAS;AAC5C,UAAM,IAAI,MAAM,OAAO,SAAS,uBAAuB;AAAA,EACzD;AAEA,SAAO,OAAO,KAAK;AACrB;AAkBA,eAAsB,gBACpB,SACe;AACf,QAAM,EAAE,SAAS,OAAO,SAAS,QAAQ,SAAS,aAAa,SAAS,IACtE;AAEF,QAAM,UAAgC;AAAA,IACpC,IAAI,OAAO,KAAK,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC;AAAA,IAC5D,MAAM;AAAA,IACN;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