@ragbits/api-client 1.4.2 → 1.6.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/autogen.types.d.ts +70 -1
- package/dist/index.cjs +18 -3
- package/dist/index.js +16 -2
- package/package.json +1 -1
package/dist/autogen.types.d.ts
CHANGED
|
@@ -30,6 +30,18 @@ export declare const MessageRole: {
|
|
|
30
30
|
readonly System: "system";
|
|
31
31
|
};
|
|
32
32
|
export type MessageRole = TypeFrom<typeof MessageRole>;
|
|
33
|
+
/**
|
|
34
|
+
* Represents the TaskStatus enum
|
|
35
|
+
*/
|
|
36
|
+
export declare const TaskStatus: {
|
|
37
|
+
readonly Pending: "pending";
|
|
38
|
+
readonly InProgress: "in_progress";
|
|
39
|
+
readonly Completed: "completed";
|
|
40
|
+
readonly Failed: "failed";
|
|
41
|
+
readonly Cancelled: "cancelled";
|
|
42
|
+
readonly Retrying: "retrying";
|
|
43
|
+
};
|
|
44
|
+
export type TaskStatus = TypeFrom<typeof TaskStatus>;
|
|
33
45
|
/**
|
|
34
46
|
* Represents the AuthType enum
|
|
35
47
|
*/
|
|
@@ -49,6 +61,12 @@ export interface ChatContext {
|
|
|
49
61
|
};
|
|
50
62
|
user: User | null;
|
|
51
63
|
session_id: string | null;
|
|
64
|
+
/**
|
|
65
|
+
* List of confirmed/declined tools from the frontend
|
|
66
|
+
*/
|
|
67
|
+
confirmed_tools: {
|
|
68
|
+
[k: string]: unknown;
|
|
69
|
+
}[] | null;
|
|
52
70
|
/**
|
|
53
71
|
* User's timezone in IANA format (e.g., 'Europe/Warsaw', 'America/New_York')
|
|
54
72
|
*/
|
|
@@ -141,6 +159,33 @@ export interface MessageUsage {
|
|
|
141
159
|
completion_tokens: number;
|
|
142
160
|
total_tokens: number;
|
|
143
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Simple task representation.
|
|
164
|
+
*/
|
|
165
|
+
export interface Task {
|
|
166
|
+
id: string;
|
|
167
|
+
description: string;
|
|
168
|
+
/**
|
|
169
|
+
* Task status options.
|
|
170
|
+
*/
|
|
171
|
+
status: 'pending' | 'in_progress' | 'completed' | 'failed' | 'cancelled' | 'retrying';
|
|
172
|
+
order: number;
|
|
173
|
+
summary: string | null;
|
|
174
|
+
parent_id: string | null;
|
|
175
|
+
full_response: string | null;
|
|
176
|
+
dependencies: string[];
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Represents a tool confirmation request sent to the user.
|
|
180
|
+
*/
|
|
181
|
+
export interface ConfirmationRequest {
|
|
182
|
+
confirmation_id: string;
|
|
183
|
+
tool_name: string;
|
|
184
|
+
tool_description: string;
|
|
185
|
+
arguments: {
|
|
186
|
+
[k: string]: unknown;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
144
189
|
/**
|
|
145
190
|
* Text content wrapper.
|
|
146
191
|
*/
|
|
@@ -179,6 +224,18 @@ export interface UsageContent {
|
|
|
179
224
|
[k: string]: MessageUsage;
|
|
180
225
|
};
|
|
181
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Plan item content wrapper.
|
|
229
|
+
*/
|
|
230
|
+
export interface PlanItemContent {
|
|
231
|
+
task: Task;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Confirmation request content wrapper.
|
|
235
|
+
*/
|
|
236
|
+
export interface ConfirmationRequestContent {
|
|
237
|
+
confirmation_request: ConfirmationRequest;
|
|
238
|
+
}
|
|
182
239
|
/**
|
|
183
240
|
* Error content wrapper for displaying error messages to users.
|
|
184
241
|
*/
|
|
@@ -214,6 +271,10 @@ export interface UICustomization {
|
|
|
214
271
|
* Custom welcome message to be displayed on the UI. It supports Markdown.
|
|
215
272
|
*/
|
|
216
273
|
welcome_message: string | null;
|
|
274
|
+
/**
|
|
275
|
+
* Starter questions displayed as clickable buttons on the welcome screen before any conversation.
|
|
276
|
+
*/
|
|
277
|
+
starter_questions: string[] | null;
|
|
217
278
|
/**
|
|
218
279
|
* Custom meta properties customization
|
|
219
280
|
*/
|
|
@@ -472,10 +533,18 @@ export interface ClearMessageChatResponse {
|
|
|
472
533
|
type: 'clear_message';
|
|
473
534
|
content: unknown;
|
|
474
535
|
}
|
|
536
|
+
export interface PlanItemChatResponse {
|
|
537
|
+
type: 'plan_item';
|
|
538
|
+
content: PlanItemContent;
|
|
539
|
+
}
|
|
475
540
|
export interface ConversationSummaryResponse {
|
|
476
541
|
type: 'conversation_summary';
|
|
477
542
|
content: ConversationSummaryContent;
|
|
478
543
|
}
|
|
544
|
+
export interface ConfirmationRequestChatResponse {
|
|
545
|
+
type: 'confirmation_request';
|
|
546
|
+
content: ConfirmationRequestContent;
|
|
547
|
+
}
|
|
479
548
|
export interface ErrorChatResponse {
|
|
480
549
|
type: 'error';
|
|
481
550
|
content: ErrorContent;
|
|
@@ -487,4 +556,4 @@ export interface ChunkedChatResponse {
|
|
|
487
556
|
/**
|
|
488
557
|
* Typed chat response union
|
|
489
558
|
*/
|
|
490
|
-
export type ChatResponse = TextChatResponse | ReferenceChatResponse | MessageIdChatResponse | ConversationIdChatResponse | StateUpdateChatResponse | LiveUpdateChatResponse | FollowupMessagesChatResponse | ImageChatResponse | MessageUsageChatResponse | ClearMessageChatResponse | ConversationSummaryResponse | ErrorChatResponse;
|
|
559
|
+
export type ChatResponse = TextChatResponse | ReferenceChatResponse | MessageIdChatResponse | ConversationIdChatResponse | StateUpdateChatResponse | LiveUpdateChatResponse | FollowupMessagesChatResponse | ImageChatResponse | MessageUsageChatResponse | ClearMessageChatResponse | PlanItemChatResponse | ConversationSummaryResponse | ConfirmationRequestChatResponse | ErrorChatResponse;
|
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,8 @@ __export(index_exports, {
|
|
|
24
24
|
FeedbackType: () => FeedbackType,
|
|
25
25
|
LiveUpdateType: () => LiveUpdateType,
|
|
26
26
|
MessageRole: () => MessageRole,
|
|
27
|
-
RagbitsClient: () => RagbitsClient
|
|
27
|
+
RagbitsClient: () => RagbitsClient,
|
|
28
|
+
TaskStatus: () => TaskStatus
|
|
28
29
|
});
|
|
29
30
|
module.exports = __toCommonJS(index_exports);
|
|
30
31
|
|
|
@@ -42,6 +43,14 @@ var MessageRole = {
|
|
|
42
43
|
Assistant: "assistant",
|
|
43
44
|
System: "system"
|
|
44
45
|
};
|
|
46
|
+
var TaskStatus = {
|
|
47
|
+
Pending: "pending",
|
|
48
|
+
InProgress: "in_progress",
|
|
49
|
+
Completed: "completed",
|
|
50
|
+
Failed: "failed",
|
|
51
|
+
Cancelled: "cancelled",
|
|
52
|
+
Retrying: "retrying"
|
|
53
|
+
};
|
|
45
54
|
var AuthType = {
|
|
46
55
|
Credentials: "credentials",
|
|
47
56
|
Oauth2: "oauth2"
|
|
@@ -49,11 +58,13 @@ var AuthType = {
|
|
|
49
58
|
|
|
50
59
|
// src/index.ts
|
|
51
60
|
var RagbitsClient = class {
|
|
61
|
+
baseUrl;
|
|
62
|
+
auth;
|
|
63
|
+
chunkQueue = /* @__PURE__ */ new Map();
|
|
52
64
|
/**
|
|
53
65
|
* @param config - Configuration object
|
|
54
66
|
*/
|
|
55
67
|
constructor(config = {}) {
|
|
56
|
-
this.chunkQueue = /* @__PURE__ */ new Map();
|
|
57
68
|
this.baseUrl = config.baseUrl ?? "";
|
|
58
69
|
this.auth = config.auth;
|
|
59
70
|
if (this.baseUrl.endsWith("/")) {
|
|
@@ -210,6 +221,9 @@ var RagbitsClient = class {
|
|
|
210
221
|
continue;
|
|
211
222
|
}
|
|
212
223
|
await callbacks.onMessage(parsedData);
|
|
224
|
+
await new Promise(
|
|
225
|
+
(resolve) => setTimeout(resolve, 0)
|
|
226
|
+
);
|
|
213
227
|
} catch (parseError) {
|
|
214
228
|
console.error("Error parsing JSON:", parseError);
|
|
215
229
|
await callbacks.onError(
|
|
@@ -341,5 +355,6 @@ var RagbitsClient = class {
|
|
|
341
355
|
FeedbackType,
|
|
342
356
|
LiveUpdateType,
|
|
343
357
|
MessageRole,
|
|
344
|
-
RagbitsClient
|
|
358
|
+
RagbitsClient,
|
|
359
|
+
TaskStatus
|
|
345
360
|
});
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,14 @@ var MessageRole = {
|
|
|
12
12
|
Assistant: "assistant",
|
|
13
13
|
System: "system"
|
|
14
14
|
};
|
|
15
|
+
var TaskStatus = {
|
|
16
|
+
Pending: "pending",
|
|
17
|
+
InProgress: "in_progress",
|
|
18
|
+
Completed: "completed",
|
|
19
|
+
Failed: "failed",
|
|
20
|
+
Cancelled: "cancelled",
|
|
21
|
+
Retrying: "retrying"
|
|
22
|
+
};
|
|
15
23
|
var AuthType = {
|
|
16
24
|
Credentials: "credentials",
|
|
17
25
|
Oauth2: "oauth2"
|
|
@@ -19,11 +27,13 @@ var AuthType = {
|
|
|
19
27
|
|
|
20
28
|
// src/index.ts
|
|
21
29
|
var RagbitsClient = class {
|
|
30
|
+
baseUrl;
|
|
31
|
+
auth;
|
|
32
|
+
chunkQueue = /* @__PURE__ */ new Map();
|
|
22
33
|
/**
|
|
23
34
|
* @param config - Configuration object
|
|
24
35
|
*/
|
|
25
36
|
constructor(config = {}) {
|
|
26
|
-
this.chunkQueue = /* @__PURE__ */ new Map();
|
|
27
37
|
this.baseUrl = config.baseUrl ?? "";
|
|
28
38
|
this.auth = config.auth;
|
|
29
39
|
if (this.baseUrl.endsWith("/")) {
|
|
@@ -180,6 +190,9 @@ var RagbitsClient = class {
|
|
|
180
190
|
continue;
|
|
181
191
|
}
|
|
182
192
|
await callbacks.onMessage(parsedData);
|
|
193
|
+
await new Promise(
|
|
194
|
+
(resolve) => setTimeout(resolve, 0)
|
|
195
|
+
);
|
|
183
196
|
} catch (parseError) {
|
|
184
197
|
console.error("Error parsing JSON:", parseError);
|
|
185
198
|
await callbacks.onError(
|
|
@@ -310,5 +323,6 @@ export {
|
|
|
310
323
|
FeedbackType,
|
|
311
324
|
LiveUpdateType,
|
|
312
325
|
MessageRole,
|
|
313
|
-
RagbitsClient
|
|
326
|
+
RagbitsClient,
|
|
327
|
+
TaskStatus
|
|
314
328
|
};
|