@uptiqai/widgets-sdk 1.89.0 → 1.91.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.css +1 -1
- package/dist/index.d.ts +190 -5
- package/dist/index.js +19053 -18691
- package/dist/index.umd.cjs +117 -117
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
2
|
+
import { MemoExoticComponent } from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
2
4
|
|
|
3
|
-
export declare type AgentInterruptEvent = EvaluationResultElement | DoneElement | StatusUpdateElement | PlanUpdateElement | ErrorElement | ToolResultElement | ToolCallElement |
|
|
5
|
+
export declare type AgentInterruptEvent = EvaluationResultElement | DoneElement | StatusUpdateElement | PlanUpdateElement | ErrorElement | ToolResultElement | ToolCallElement | AgentMessage_2 | ContextualKnowledgeElement | PausedElement;
|
|
4
6
|
|
|
5
|
-
declare
|
|
7
|
+
export declare const AgentMessage: MemoExoticComponent<({ message, isSelected, onClick, annotationOverlay, selectionIndicator, className, hideMetadata, hideActions, showBorder, onOpenToolsPanel, onOpenPlanPanel, onOpenCustomWidget, selectedCustomWidget }: AgentMessageProps) => JSX_2.Element>;
|
|
8
|
+
|
|
9
|
+
declare type AgentMessage_2 = ConversationElement & {
|
|
6
10
|
type: ConversationElementType.AGENT_MESSAGE;
|
|
7
11
|
content: string;
|
|
8
12
|
subtype: 'thinking_started' | 'thinking_completed' | 'guardrail_started' | 'guardrail_ended' | 'strategy_updated' | 'thinking_failed' | 'intermediate' | 'final' | 'question' | 'workflow_task' | 'final_stream' | 'attach_files' | 'output_files' | 'ask_permission';
|
|
@@ -20,11 +24,34 @@ declare type AgentMessage = ConversationElement & {
|
|
|
20
24
|
parentMessageId?: string;
|
|
21
25
|
};
|
|
22
26
|
|
|
27
|
+
export declare type AgentMessageAnnotationProps = {
|
|
28
|
+
isSelected?: boolean;
|
|
29
|
+
onClick?: () => void;
|
|
30
|
+
annotationOverlay?: ReactNode;
|
|
31
|
+
selectionIndicator?: ReactNode;
|
|
32
|
+
className?: string;
|
|
33
|
+
hideMetadata?: boolean;
|
|
34
|
+
hideActions?: boolean;
|
|
35
|
+
showBorder?: boolean;
|
|
36
|
+
message: SdkAgentMessage;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export declare type AgentMessageContextProps = {
|
|
40
|
+
onOpenToolsPanel?: (message: SdkAgentMessage) => void;
|
|
41
|
+
onOpenPlanPanel?: (message: SdkAgentMessage) => void;
|
|
42
|
+
onOpenCustomWidget?: (widget: SdkCustomWidget) => void;
|
|
43
|
+
selectedCustomWidget?: SdkCustomWidget;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
declare type AgentMessageProps = AgentMessageAnnotationProps & AgentMessageContextProps;
|
|
47
|
+
|
|
23
48
|
declare enum AgentResponseFormat {
|
|
24
49
|
Json = "Json",
|
|
25
50
|
Markdown = "Markdown"
|
|
26
51
|
}
|
|
27
52
|
|
|
53
|
+
declare type AiMessage = EvaluationResultElement | DoneElement | StatusUpdateElement | PlanUpdateElement | ErrorElement | ToolResultElement | ToolCallElement | AgentMessage_2 | ContextualKnowledgeElement | PausedElement;
|
|
54
|
+
|
|
28
55
|
declare type AttachedDocument = {
|
|
29
56
|
id: string;
|
|
30
57
|
fileName?: string;
|
|
@@ -34,6 +61,26 @@ declare type AttachedDocument = {
|
|
|
34
61
|
state?: DocumentProcessingState;
|
|
35
62
|
};
|
|
36
63
|
|
|
64
|
+
export declare type ChatMessage = UserMessage_2 | AiMessage;
|
|
65
|
+
|
|
66
|
+
export declare const ChatRightPanel: ({ isOpen: externalIsOpen, onClose: externalOnClose, selectedTab: externalSelectedTab, onTabChange: externalOnTabChange, selectedMessage: externalSelectedMessage, container: externalContainer, useThinkingState }?: ChatRightPanelProps) => JSX_2.Element;
|
|
67
|
+
|
|
68
|
+
export declare type ChatRightPanelProps = {
|
|
69
|
+
isOpen?: boolean;
|
|
70
|
+
onClose?: () => void;
|
|
71
|
+
selectedTab?: ChatRightPanelTab;
|
|
72
|
+
onTabChange?: (tab: ChatRightPanelTab) => void;
|
|
73
|
+
selectedMessage?: SdkAgentMessage;
|
|
74
|
+
container?: HTMLElement | null;
|
|
75
|
+
useThinkingState?: boolean;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export declare enum ChatRightPanelTab {
|
|
79
|
+
Plan = "Plan",
|
|
80
|
+
Tools = "Tools",
|
|
81
|
+
ContextualKnowledge = "ContextualKnowledge"
|
|
82
|
+
}
|
|
83
|
+
|
|
37
84
|
export declare const ChatWidget: ({ onClose, embedded, ...props }: ChatWidgetProps) => JSX_2.Element;
|
|
38
85
|
|
|
39
86
|
declare type ChatWidgetContainerProps = (ChatWidgetPopupContainerProps & {
|
|
@@ -76,7 +123,7 @@ declare type CommonWidgetProps = {
|
|
|
76
123
|
enableViewOnObservability?: boolean;
|
|
77
124
|
};
|
|
78
125
|
|
|
79
|
-
declare type ContextualKnowledge = {
|
|
126
|
+
export declare type ContextualKnowledge = {
|
|
80
127
|
knowledge: string;
|
|
81
128
|
userRequest: string;
|
|
82
129
|
};
|
|
@@ -161,6 +208,23 @@ declare type FullChatWidgetContainerProps = {
|
|
|
161
208
|
widgetRef?: React.Ref<FullScreenChatWidgetRef>;
|
|
162
209
|
};
|
|
163
210
|
|
|
211
|
+
export declare const FullScreenAnnotationChatWidget: ({ defaultOpen, widgetRef, onClose, hideTrigger, ...props }: FullScreenAnnotationChatWidgetProps) => JSX_2.Element;
|
|
212
|
+
|
|
213
|
+
declare type FullScreenAnnotationChatWidgetContainerProps = {
|
|
214
|
+
children: React.ReactNode;
|
|
215
|
+
defaultOpen?: boolean;
|
|
216
|
+
hideTrigger?: boolean;
|
|
217
|
+
onClose?: () => void;
|
|
218
|
+
widgetRef?: React.Ref<FullScreenAnnotationChatWidgetRef>;
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
export declare type FullScreenAnnotationChatWidgetProps = CommonWidgetProps & Omit<FullScreenAnnotationChatWidgetContainerProps, 'children'>;
|
|
222
|
+
|
|
223
|
+
export declare type FullScreenAnnotationChatWidgetRef = {
|
|
224
|
+
open: () => void;
|
|
225
|
+
close: () => void;
|
|
226
|
+
};
|
|
227
|
+
|
|
164
228
|
export declare const FullScreenChatWidget: ({ defaultOpen, widgetRef, onClose, hideTrigger, ...props }: FullScreenChatWidgetProps) => JSX_2.Element;
|
|
165
229
|
|
|
166
230
|
export declare type FullScreenChatWidgetProps = CommonWidgetProps & Omit<FullChatWidgetContainerProps, 'children'>;
|
|
@@ -180,6 +244,8 @@ declare type HeadlessEventHandler<T extends HeadlessEventType> = T extends 'agen
|
|
|
180
244
|
|
|
181
245
|
declare type HeadlessEventType = 'agent-interrupt';
|
|
182
246
|
|
|
247
|
+
export declare type IntermediateAgentMessage = Omit<SdkAgentMessage, 'intermediateMessages'>;
|
|
248
|
+
|
|
183
249
|
declare type PausedElement = ConversationElement & {
|
|
184
250
|
type: ConversationElementType.PAUSED;
|
|
185
251
|
resumeInfo: any;
|
|
@@ -191,13 +257,13 @@ declare type PermissionRequest = {
|
|
|
191
257
|
description: string;
|
|
192
258
|
};
|
|
193
259
|
|
|
194
|
-
declare type Plan = {
|
|
260
|
+
export declare type Plan = {
|
|
195
261
|
id: string;
|
|
196
262
|
status: 'running' | 'completed' | 'failed';
|
|
197
263
|
steps: PlanStep[];
|
|
198
264
|
};
|
|
199
265
|
|
|
200
|
-
declare type PlanStep = {
|
|
266
|
+
export declare type PlanStep = {
|
|
201
267
|
id: string;
|
|
202
268
|
description: string;
|
|
203
269
|
status: 'pending' | 'running' | 'paused' | 'completed' | 'failed' | 'waiting_for_input';
|
|
@@ -215,6 +281,81 @@ export declare type QueryPayload = {
|
|
|
215
281
|
files?: File[];
|
|
216
282
|
};
|
|
217
283
|
|
|
284
|
+
declare type SdkAgentGuardrailMessage = {
|
|
285
|
+
id: string;
|
|
286
|
+
intent: string;
|
|
287
|
+
result?: string;
|
|
288
|
+
startTime: Date;
|
|
289
|
+
endTime?: Date;
|
|
290
|
+
metadata?: Record<string, any>;
|
|
291
|
+
type: SdkAgentStepType.GUARDRAIL;
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
export declare type SdkAgentMessage = Pick<AgentMessage_2, 'content' | 'id' | 'timestamp' | 'metadata'> & {
|
|
295
|
+
type: 'agent';
|
|
296
|
+
subtype?: AgentMessage_2['subtype'];
|
|
297
|
+
plan?: Plan;
|
|
298
|
+
thinking?: {
|
|
299
|
+
startTime: Date;
|
|
300
|
+
endTime: Date;
|
|
301
|
+
};
|
|
302
|
+
contextualKnowledge?: ContextualKnowledge;
|
|
303
|
+
usedMemories?: UsedMemories;
|
|
304
|
+
isStreaming?: boolean;
|
|
305
|
+
intermediateMessages?: IntermediateAgentMessage[];
|
|
306
|
+
agentSteps?: SdkAgentStep[];
|
|
307
|
+
selectedStrategy?: string;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
declare type SdkAgentStep = SdkTool | SdkAgentThinkingMessage | SdkAgentGuardrailMessage;
|
|
311
|
+
|
|
312
|
+
declare enum SdkAgentStepType {
|
|
313
|
+
TOOL_CALL = "TOOL_CALL",
|
|
314
|
+
THINKING = "THINKING",
|
|
315
|
+
GUARDRAIL = "GUARDRAIL"
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
declare type SdkAgentThinkingMessage = {
|
|
319
|
+
id: string;
|
|
320
|
+
intent: string;
|
|
321
|
+
thoughtProcess?: string;
|
|
322
|
+
startTime: Date;
|
|
323
|
+
endTime?: Date;
|
|
324
|
+
metadata?: Record<string, any>;
|
|
325
|
+
type: SdkAgentStepType.THINKING;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
export declare type SdkChatMessage = SdkUserMessage | SdkAgentMessage;
|
|
329
|
+
|
|
330
|
+
export declare type SdkCustomWidget = {
|
|
331
|
+
widgetId: string;
|
|
332
|
+
toolResult?: any;
|
|
333
|
+
uri: string;
|
|
334
|
+
title: string;
|
|
335
|
+
timestamp: Date;
|
|
336
|
+
toolId: string;
|
|
337
|
+
metadata?: Record<string, any>;
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
export declare type SdkTool = {
|
|
341
|
+
id: string;
|
|
342
|
+
inputs: Record<string, any>;
|
|
343
|
+
intent?: string;
|
|
344
|
+
name: string;
|
|
345
|
+
startTime: Date;
|
|
346
|
+
endTime?: Date;
|
|
347
|
+
result?: any;
|
|
348
|
+
widget?: ToolWidgetMetaData;
|
|
349
|
+
metadata?: Record<string, any>;
|
|
350
|
+
type: SdkAgentStepType.TOOL_CALL;
|
|
351
|
+
error?: string;
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
export declare type SdkUserMessage = Pick<UserMessage_2, 'metadata' | 'id' | 'content' | 'timestamp'> & {
|
|
355
|
+
type: 'user';
|
|
356
|
+
status?: 'pending' | 'acknowledged' | 'error' | 'failed';
|
|
357
|
+
};
|
|
358
|
+
|
|
218
359
|
declare interface StatusUpdateElement extends ConversationElement {
|
|
219
360
|
type: ConversationElementType.STATUS_UPDATE;
|
|
220
361
|
status: string;
|
|
@@ -249,6 +390,18 @@ declare type ToolWidgetMetaData = {
|
|
|
249
390
|
toolId: string;
|
|
250
391
|
};
|
|
251
392
|
|
|
393
|
+
export declare const transformMessagesToSdkMessages: (_messages: ChatMessage[]) => {
|
|
394
|
+
messages: SdkChatMessage[];
|
|
395
|
+
thinking: {
|
|
396
|
+
startTime: Date;
|
|
397
|
+
content: string;
|
|
398
|
+
} | undefined;
|
|
399
|
+
plan: Plan | undefined;
|
|
400
|
+
currentIntermediateMessage: IntermediateAgentMessage | undefined;
|
|
401
|
+
intermediateMessages: IntermediateAgentMessage[];
|
|
402
|
+
agentSteps: SdkAgentStep[];
|
|
403
|
+
};
|
|
404
|
+
|
|
252
405
|
/** FAQs and user persona memories that were used during agent execution */
|
|
253
406
|
declare interface UsedMemories {
|
|
254
407
|
faqs?: Array<{
|
|
@@ -265,6 +418,38 @@ declare interface UsedMemories {
|
|
|
265
418
|
};
|
|
266
419
|
}
|
|
267
420
|
|
|
421
|
+
export declare const UserMessage: ({ message, isSelected, onClick, annotationOverlay, selectionIndicator, className }: UserMessageProps) => JSX_2.Element;
|
|
422
|
+
|
|
423
|
+
declare type UserMessage_2 = ConversationElement & {
|
|
424
|
+
type: ConversationElementType.USER_MESSAGE;
|
|
425
|
+
content: string;
|
|
426
|
+
subtype: 'text' | 'file';
|
|
427
|
+
source: 'direct' | 'slack' | 'discord' | 'teams' | 'api';
|
|
428
|
+
status?: 'pending' | 'acknowledged' | 'error' | 'failed';
|
|
429
|
+
metadata?: {
|
|
430
|
+
channel?: string;
|
|
431
|
+
thread?: string[];
|
|
432
|
+
user?: string;
|
|
433
|
+
platform?: string;
|
|
434
|
+
questionId?: string;
|
|
435
|
+
fileName?: string;
|
|
436
|
+
documents?: AttachedDocument[];
|
|
437
|
+
payload?: any;
|
|
438
|
+
};
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
export declare type UserMessageAnnotationProps = {
|
|
442
|
+
isSelected?: boolean;
|
|
443
|
+
onClick?: () => void;
|
|
444
|
+
annotationOverlay?: ReactNode;
|
|
445
|
+
selectionIndicator?: ReactNode;
|
|
446
|
+
className?: string;
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
declare type UserMessageProps = {
|
|
450
|
+
message: SdkUserMessage;
|
|
451
|
+
} & UserMessageAnnotationProps;
|
|
452
|
+
|
|
268
453
|
declare type WidgetConfig = {
|
|
269
454
|
serverUrl: string;
|
|
270
455
|
agentId: string;
|