@uptiqai/widgets-sdk 1.34.0 → 1.35.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 +175 -0
- package/dist/index.js +8800 -8669
- package/dist/index.umd.cjs +85 -85
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
+
export declare type AgentInterruptEvent = EvaluationResultElement | DoneElement | StatusUpdateElement | PlanUpdateElement | ErrorElement | ToolResultElement | ToolCallElement | AgentMessage | ContextualKnowledgeElement | PausedElement;
|
|
4
|
+
|
|
5
|
+
declare type AgentMessage = ConversationElement & {
|
|
6
|
+
type: ConversationElementType.AGENT_MESSAGE;
|
|
7
|
+
content: string;
|
|
8
|
+
subtype: 'intermediate' | 'final' | 'question' | 'final_stream' | 'output_files' | 'ask_permission';
|
|
9
|
+
isStreaming?: boolean;
|
|
10
|
+
relatedStepId?: string;
|
|
11
|
+
expectedResponseType?: 'text' | 'boolean' | 'selection' | 'json';
|
|
12
|
+
options?: string[];
|
|
13
|
+
taskData?: Record<string, any>;
|
|
14
|
+
metadata?: {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
documents?: AttachedDocument[];
|
|
17
|
+
requestedSchema?: any;
|
|
18
|
+
permissionRequest?: PermissionRequest;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
declare type AttachedDocument = {
|
|
23
|
+
id: string;
|
|
24
|
+
fileName?: string;
|
|
25
|
+
summary?: string;
|
|
26
|
+
mimeType?: string;
|
|
27
|
+
source?: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
3
30
|
export declare const ChatWidget: ({ onClose, embedded, ...props }: ChatWidgetProps) => JSX_2.Element;
|
|
4
31
|
|
|
5
32
|
declare type ChatWidgetContainerProps = (ChatWidgetPopupContainerProps & {
|
|
@@ -40,6 +67,74 @@ declare type CommonWidgetProps = {
|
|
|
40
67
|
filterConversationsByUser?: boolean;
|
|
41
68
|
};
|
|
42
69
|
|
|
70
|
+
declare type ContextualKnowledge = {
|
|
71
|
+
knowledge: string;
|
|
72
|
+
userRequest: string;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
declare type ContextualKnowledgeElement = ConversationElement & ContextualKnowledge & {
|
|
76
|
+
type: ConversationElementType.CONTEXTUAL_KNOWLEDGE;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
declare type ConversationElement = {
|
|
80
|
+
id: string;
|
|
81
|
+
type: ConversationElementType;
|
|
82
|
+
timestamp: Date;
|
|
83
|
+
conversationId?: string;
|
|
84
|
+
metadata?: Record<string, any>;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
declare enum ConversationElementType {
|
|
88
|
+
USER_MESSAGE = "user_message",
|
|
89
|
+
AGENT_MESSAGE = "agent_message",
|
|
90
|
+
TOOL_CALL = "tool_call",
|
|
91
|
+
TOOL_RESULT = "tool_result",
|
|
92
|
+
PLAN_UPDATE = "plan_update",
|
|
93
|
+
STATUS_UPDATE = "status_update",
|
|
94
|
+
CONTEXTUAL_KNOWLEDGE = "contextual_knowledge",
|
|
95
|
+
EVALUATION_RESULT = "evaluation_result",
|
|
96
|
+
PAUSED = "paused",
|
|
97
|
+
DONE = "done",
|
|
98
|
+
ERROR = "error"
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export declare const createHeadlessAgentInstance: (params: CreateHeadlessAgentInstanceParams) => HeadlessAgentInstance;
|
|
102
|
+
|
|
103
|
+
export declare type CreateHeadlessAgentInstanceParams = Pick<CreateWidgetInstanceParams, 'config' | 'user' | 'instanceId'>;
|
|
104
|
+
|
|
105
|
+
declare type CreateWidgetInstanceParams = Omit<CommonWidgetProps, 'theme'> & {
|
|
106
|
+
instanceId: string;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
declare interface DoneElement extends ConversationElement {
|
|
110
|
+
type: ConversationElementType.DONE;
|
|
111
|
+
plan?: Plan;
|
|
112
|
+
content?: string;
|
|
113
|
+
error?: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
declare type ErrorElement = ConversationElement & {
|
|
117
|
+
type: ConversationElementType.ERROR;
|
|
118
|
+
error: string;
|
|
119
|
+
source: 'agent' | 'tool' | 'system' | 'external';
|
|
120
|
+
context?: {
|
|
121
|
+
toolName?: string;
|
|
122
|
+
stepId?: string;
|
|
123
|
+
originalRequest?: string;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
declare type EvaluationResponse = {
|
|
128
|
+
score: number;
|
|
129
|
+
reasoning: string;
|
|
130
|
+
is_correct: boolean;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
declare interface EvaluationResultElement extends ConversationElement {
|
|
134
|
+
type: ConversationElementType.EVALUATION_RESULT;
|
|
135
|
+
result: EvaluationResponse;
|
|
136
|
+
}
|
|
137
|
+
|
|
43
138
|
declare type FullChatWidgetContainerProps = {
|
|
44
139
|
children: React.ReactNode;
|
|
45
140
|
defaultOpen?: boolean;
|
|
@@ -57,6 +152,86 @@ export declare type FullScreenChatWidgetRef = {
|
|
|
57
152
|
close: () => void;
|
|
58
153
|
};
|
|
59
154
|
|
|
155
|
+
export declare type HeadlessAgentInstance = {
|
|
156
|
+
emit: (event: 'query', payload: QueryPayload) => void;
|
|
157
|
+
on: <T extends HeadlessEventType>(event: T, handler: HeadlessEventHandler<T>) => () => void;
|
|
158
|
+
cleanup: () => void;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
declare type HeadlessEventHandler<T extends HeadlessEventType> = T extends 'agent-interrupt' ? (message: AgentInterruptEvent) => void : never;
|
|
162
|
+
|
|
163
|
+
declare type HeadlessEventType = 'agent-interrupt';
|
|
164
|
+
|
|
165
|
+
declare type PausedElement = ConversationElement & {
|
|
166
|
+
type: ConversationElementType.PAUSED;
|
|
167
|
+
resumeInfo: any;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
declare type PermissionRequest = {
|
|
171
|
+
id: string;
|
|
172
|
+
title: string;
|
|
173
|
+
description: string;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
declare type Plan = {
|
|
177
|
+
id: string;
|
|
178
|
+
status: 'running' | 'completed' | 'failed';
|
|
179
|
+
steps: PlanStep[];
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
declare type PlanStep = {
|
|
183
|
+
id: string;
|
|
184
|
+
description: string;
|
|
185
|
+
status: 'pending' | 'running' | 'paused' | 'completed' | 'failed' | 'waiting_for_input';
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
declare type PlanUpdateElement = ConversationElement & {
|
|
189
|
+
type: ConversationElementType.PLAN_UPDATE;
|
|
190
|
+
plan?: Plan;
|
|
191
|
+
changeType: 'created' | 'updated' | 'step_added' | 'step_updated' | 'completed';
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
export declare type QueryPayload = {
|
|
195
|
+
content: string;
|
|
196
|
+
executionId?: string;
|
|
197
|
+
files?: File[];
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
declare interface StatusUpdateElement extends ConversationElement {
|
|
201
|
+
type: ConversationElementType.STATUS_UPDATE;
|
|
202
|
+
status: string;
|
|
203
|
+
context?: string;
|
|
204
|
+
relatedStepId?: string;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
declare type ToolCallElement = ConversationElement & {
|
|
208
|
+
type: ConversationElementType.TOOL_CALL;
|
|
209
|
+
skillId: string;
|
|
210
|
+
toolName: string;
|
|
211
|
+
intent?: string;
|
|
212
|
+
inputs: Record<string, any>;
|
|
213
|
+
status: 'pending' | 'executing' | 'completed' | 'failed';
|
|
214
|
+
relatedStepId?: string;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
declare type ToolResultElement = ConversationElement & {
|
|
218
|
+
type: ConversationElementType.TOOL_RESULT;
|
|
219
|
+
toolCallId: string;
|
|
220
|
+
result: any;
|
|
221
|
+
success: boolean;
|
|
222
|
+
error?: string;
|
|
223
|
+
duration?: number;
|
|
224
|
+
widget?: ToolWidgetMetaData;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
declare type ToolWidgetMetaData = {
|
|
228
|
+
uri: string;
|
|
229
|
+
widgetId: string;
|
|
230
|
+
content: string;
|
|
231
|
+
title: string;
|
|
232
|
+
toolId: string;
|
|
233
|
+
};
|
|
234
|
+
|
|
60
235
|
declare type WidgetConfig = {
|
|
61
236
|
serverUrl: string;
|
|
62
237
|
agentId: string;
|