@xpert-ai/chatkit-types 0.0.4 → 0.0.6
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.d.ts +1173 -1
- package/dist/index.js +30 -793
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,226 @@
|
|
|
1
1
|
import { ToolCall } from '@langchain/core/messages/tool';
|
|
2
|
+
import { Types } from '@a2ui/lit/0.8';
|
|
3
|
+
|
|
4
|
+
export declare type AccentColor = {
|
|
5
|
+
primary: string;
|
|
6
|
+
level: 0 | 1 | 2 | 3;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
declare type ActionConfig = {
|
|
10
|
+
type: string;
|
|
11
|
+
payload?: Record<string, unknown>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
declare type Alignment = 'start' | 'center' | 'end' | 'baseline' | 'stretch';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* strategies to host files before attaching them to messages.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Attachment associated with a user message. When passed to `sendUserMessage` or
|
|
21
|
+
* `setComposerValue`, it must already be uploaded by your server. We do not currently
|
|
22
|
+
* support attaching raw Files to a message.
|
|
23
|
+
*/
|
|
24
|
+
export declare type Attachment = {
|
|
25
|
+
type: 'file';
|
|
26
|
+
/** Server-generated identifier for the uploaded file. */
|
|
27
|
+
id: string;
|
|
28
|
+
/** Original filename shown in the UI. */
|
|
29
|
+
name: string;
|
|
30
|
+
/** MIME type of the file. */
|
|
31
|
+
mime_type: string;
|
|
32
|
+
} | {
|
|
33
|
+
type: 'image';
|
|
34
|
+
/** Server-generated identifier for the uploaded image. */
|
|
35
|
+
id: string;
|
|
36
|
+
/** URL used to render the image preview in the UI. */
|
|
37
|
+
preview_url: string;
|
|
38
|
+
/** Original filename shown in the UI. */
|
|
39
|
+
name: string;
|
|
40
|
+
/** MIME type of the image. */
|
|
41
|
+
mime_type: string;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export declare type Badge = {
|
|
45
|
+
type: 'Badge';
|
|
46
|
+
key?: string;
|
|
47
|
+
id?: string;
|
|
48
|
+
label: string;
|
|
49
|
+
color?: 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'discovery';
|
|
50
|
+
variant?: 'solid' | 'soft' | 'outline';
|
|
51
|
+
size?: 'sm' | 'md' | 'lg';
|
|
52
|
+
pill?: boolean;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
declare type BaseTextProps = {
|
|
56
|
+
value: string;
|
|
57
|
+
color?: string | ThemeColor;
|
|
58
|
+
weight?: 'normal' | 'medium' | 'semibold' | 'bold';
|
|
59
|
+
textAlign?: TextAlign;
|
|
60
|
+
truncate?: boolean;
|
|
61
|
+
maxLines?: number;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export declare type BasicRoot = {
|
|
65
|
+
type: 'Basic';
|
|
66
|
+
key?: string;
|
|
67
|
+
id?: string;
|
|
68
|
+
children: (WidgetComponent | WidgetRoot)[];
|
|
69
|
+
theme?: 'light' | 'dark';
|
|
70
|
+
direction?: 'row' | 'col';
|
|
71
|
+
} & Pick<BoxBaseProps, 'gap' | 'padding' | 'align' | 'justify'>;
|
|
72
|
+
|
|
73
|
+
declare type BlockProps = {
|
|
74
|
+
height?: number | string;
|
|
75
|
+
width?: number | string;
|
|
76
|
+
size?: number | string;
|
|
77
|
+
minHeight?: number | string;
|
|
78
|
+
minWidth?: number | string;
|
|
79
|
+
minSize?: number | string;
|
|
80
|
+
maxHeight?: number | string;
|
|
81
|
+
maxWidth?: number | string;
|
|
82
|
+
maxSize?: number | string;
|
|
83
|
+
aspectRatio?: number | string;
|
|
84
|
+
radius?: RadiusValue;
|
|
85
|
+
margin?: number | string | Spacing;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
declare type Border = {
|
|
89
|
+
size: number;
|
|
90
|
+
color?: string | ThemeColor;
|
|
91
|
+
style?: 'solid' | 'dashed' | 'dotted' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset';
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
declare type Borders = {
|
|
95
|
+
top?: number | Border;
|
|
96
|
+
right?: number | Border;
|
|
97
|
+
bottom?: number | Border;
|
|
98
|
+
left?: number | Border;
|
|
99
|
+
x?: number | Border;
|
|
100
|
+
y?: number | Border;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export declare type Box = {
|
|
104
|
+
type: 'Box';
|
|
105
|
+
key?: string;
|
|
106
|
+
id?: string;
|
|
107
|
+
direction?: 'row' | 'col';
|
|
108
|
+
} & BoxBaseProps;
|
|
109
|
+
|
|
110
|
+
declare type BoxBaseProps = {
|
|
111
|
+
children?: WidgetComponent[];
|
|
112
|
+
align?: Alignment;
|
|
113
|
+
justify?: Justification;
|
|
114
|
+
wrap?: 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
115
|
+
flex?: number | string;
|
|
116
|
+
gap?: number | string;
|
|
117
|
+
padding?: number | string | Spacing;
|
|
118
|
+
border?: number | Border | Borders;
|
|
119
|
+
background?: string | ThemeColor;
|
|
120
|
+
} & BlockProps;
|
|
121
|
+
|
|
122
|
+
export declare type Button = {
|
|
123
|
+
type: 'Button';
|
|
124
|
+
key?: string;
|
|
125
|
+
id?: string;
|
|
126
|
+
submit?: boolean;
|
|
127
|
+
label?: string;
|
|
128
|
+
onClickAction?: ActionConfig;
|
|
129
|
+
iconStart?: WidgetIcon;
|
|
130
|
+
iconEnd?: WidgetIcon;
|
|
131
|
+
style?: 'primary' | 'secondary';
|
|
132
|
+
iconSize?: 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
133
|
+
color?: 'primary' | 'secondary' | 'info' | 'discovery' | 'success' | 'caution' | 'warning' | 'danger';
|
|
134
|
+
variant?: ControlVariant;
|
|
135
|
+
size?: ControlSize;
|
|
136
|
+
pill?: boolean;
|
|
137
|
+
uniform?: boolean;
|
|
138
|
+
block?: boolean;
|
|
139
|
+
disabled?: boolean;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export declare type Caption = {
|
|
143
|
+
type: 'Caption';
|
|
144
|
+
key?: string;
|
|
145
|
+
id?: string;
|
|
146
|
+
size?: CaptionSize;
|
|
147
|
+
} & BaseTextProps;
|
|
148
|
+
|
|
149
|
+
declare type CaptionSize = 'sm' | 'md' | 'lg';
|
|
150
|
+
|
|
151
|
+
export declare type Card = {
|
|
152
|
+
type: 'Card';
|
|
153
|
+
key?: string;
|
|
154
|
+
id?: string;
|
|
155
|
+
asForm?: boolean;
|
|
156
|
+
children: WidgetComponent[];
|
|
157
|
+
background?: string | ThemeColor;
|
|
158
|
+
size?: 'sm' | 'md' | 'lg' | 'full';
|
|
159
|
+
padding?: number | string | Spacing;
|
|
160
|
+
status?: WidgetStatus;
|
|
161
|
+
collapsed?: boolean;
|
|
162
|
+
confirm?: CardAction;
|
|
163
|
+
cancel?: CardAction;
|
|
164
|
+
theme?: 'light' | 'dark';
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
declare type CardAction = {
|
|
168
|
+
label: string;
|
|
169
|
+
action: ActionConfig;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export declare interface ChatKitElementEventMap {
|
|
173
|
+
'chatkit.error': CustomEvent<{
|
|
174
|
+
error: Error;
|
|
175
|
+
}>;
|
|
176
|
+
'chatkit.response.start': CustomEvent<void>;
|
|
177
|
+
'chatkit.response.end': CustomEvent<void>;
|
|
178
|
+
'chatkit.thread.change': CustomEvent<{
|
|
179
|
+
threadId: string | null;
|
|
180
|
+
}>;
|
|
181
|
+
'chatkit.log': CustomEvent<{
|
|
182
|
+
name: string;
|
|
183
|
+
data?: Record<string, unknown>;
|
|
184
|
+
}>;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* DOM events emitted by the `xpertai-chatkit` custom element.
|
|
189
|
+
*/
|
|
190
|
+
export declare type ChatKitEvents = {
|
|
191
|
+
/** Emitted when the ChatKit frame has loaded. */
|
|
192
|
+
'chatkit.ready': CustomEvent<void>;
|
|
193
|
+
/** Emitted when an error occurs. You should log these for monitoring and debugging. */
|
|
194
|
+
'chatkit.error': CustomEvent<{
|
|
195
|
+
error: Error;
|
|
196
|
+
}>;
|
|
197
|
+
/** Emitted when a fire-and-forget client effect is triggered. */
|
|
198
|
+
'chatkit.effect': CustomEvent<{
|
|
199
|
+
name: string;
|
|
200
|
+
data?: Record<string, unknown>;
|
|
201
|
+
}>;
|
|
202
|
+
/** Emitted when the assistant begins sending a response. */
|
|
203
|
+
'chatkit.response.start': CustomEvent<void>;
|
|
204
|
+
/** Emitted when the assistant finishes sending a response. */
|
|
205
|
+
'chatkit.response.end': CustomEvent<void>;
|
|
206
|
+
/** Emitted when the active thread changes. Use this along with `initialThread` to persist the current thread across page loads or sessions. */
|
|
207
|
+
'chatkit.thread.change': CustomEvent<{
|
|
208
|
+
threadId: string | null;
|
|
209
|
+
}>;
|
|
210
|
+
/** Emitted when ChatKit starts loading a thread (initial load or selected from history). */
|
|
211
|
+
'chatkit.thread.load.start': CustomEvent<{
|
|
212
|
+
threadId: string;
|
|
213
|
+
}>;
|
|
214
|
+
/** Emitted when ChatKit finished loading a thread. */
|
|
215
|
+
'chatkit.thread.load.end': CustomEvent<{
|
|
216
|
+
threadId: string;
|
|
217
|
+
}>;
|
|
218
|
+
/** Diagnostic events that can be used for logging/analytics. */
|
|
219
|
+
'chatkit.log': CustomEvent<{
|
|
220
|
+
name: string;
|
|
221
|
+
data?: Record<string, unknown>;
|
|
222
|
+
}>;
|
|
223
|
+
};
|
|
2
224
|
|
|
3
225
|
export declare interface ChatkitMessage {
|
|
4
226
|
status?: string;
|
|
@@ -8,6 +230,226 @@ export declare interface ChatkitMessage {
|
|
|
8
230
|
id: string;
|
|
9
231
|
}
|
|
10
232
|
|
|
233
|
+
export declare type ChatKitOptions = {
|
|
234
|
+
api: CustomApiConfig | HostedApiConfig;
|
|
235
|
+
/**
|
|
236
|
+
* Locale override for ChatKit UI. If not provided, the browser's locale
|
|
237
|
+
* will be used. If the locale is not supported, will fall back to English.
|
|
238
|
+
*
|
|
239
|
+
* @default navigator.language
|
|
240
|
+
*/
|
|
241
|
+
locale?: SupportedLocale;
|
|
242
|
+
/**
|
|
243
|
+
* Visual appearance configuration options for ChatKit.
|
|
244
|
+
* * @default "light"
|
|
245
|
+
*/
|
|
246
|
+
theme?: ColorScheme | ChatKitTheme;
|
|
247
|
+
/**
|
|
248
|
+
* The ID of the thread to show when ChatKit is mounted or opened for the first time.
|
|
249
|
+
* Passing `null` will show the new thread view.
|
|
250
|
+
*
|
|
251
|
+
* @default null
|
|
252
|
+
*/
|
|
253
|
+
initialThread?: null | string;
|
|
254
|
+
/**
|
|
255
|
+
* A map of handlers for the client tools configured on your server. The keys
|
|
256
|
+
* are the names of the client tools, and the values are functions that
|
|
257
|
+
* will be called when the client tool is invoked. The object (or promise) returned
|
|
258
|
+
* from the function will be sent back to the server as the result of the client
|
|
259
|
+
* tool invocation.
|
|
260
|
+
*/
|
|
261
|
+
onClientTool?: ({ name, params, id, tool_call_id, }: {
|
|
262
|
+
name: string;
|
|
263
|
+
params: Record<string, unknown>;
|
|
264
|
+
id?: string;
|
|
265
|
+
tool_call_id?: string;
|
|
266
|
+
}) => Promise<ClientToolMessageInput> | ClientToolMessageInput;
|
|
267
|
+
/**
|
|
268
|
+
* Whether to show the header in ChatKit. A configuration object can be
|
|
269
|
+
* provided to customize the header.
|
|
270
|
+
*/
|
|
271
|
+
header?: {
|
|
272
|
+
enabled?: boolean;
|
|
273
|
+
/**
|
|
274
|
+
* Configuration for header title display, which defaults to showing thread titles.
|
|
275
|
+
*/
|
|
276
|
+
title?: {
|
|
277
|
+
/**
|
|
278
|
+
* @default true
|
|
279
|
+
*/
|
|
280
|
+
enabled?: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Static text to show in the header title area. When not provided, the
|
|
283
|
+
* title of the current thread will be shown instead.
|
|
284
|
+
*/
|
|
285
|
+
text?: string;
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
288
|
+
* Configuration for an additional custom button on the left side of the header.
|
|
289
|
+
*/
|
|
290
|
+
leftAction?: {
|
|
291
|
+
icon: HeaderIcon;
|
|
292
|
+
onClick: () => void;
|
|
293
|
+
};
|
|
294
|
+
/**
|
|
295
|
+
* Configuration for an additional custom button on the right side of the header.
|
|
296
|
+
*/
|
|
297
|
+
rightAction?: {
|
|
298
|
+
icon: HeaderIcon;
|
|
299
|
+
onClick: () => void;
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
history?: {
|
|
303
|
+
enabled?: boolean;
|
|
304
|
+
showDelete?: boolean;
|
|
305
|
+
showRename?: boolean;
|
|
306
|
+
};
|
|
307
|
+
startScreen?: {
|
|
308
|
+
/**
|
|
309
|
+
* The greeting text in the new thread view.
|
|
310
|
+
*
|
|
311
|
+
* @default "What can I help with today?"
|
|
312
|
+
*/
|
|
313
|
+
greeting?: string;
|
|
314
|
+
/**
|
|
315
|
+
* A list of starter prompts to show above the composer input when in the new thread view.
|
|
316
|
+
*/
|
|
317
|
+
prompts?: StartScreenPrompt[];
|
|
318
|
+
};
|
|
319
|
+
threadItemActions?: {
|
|
320
|
+
/**
|
|
321
|
+
* Whether or not to show the response feedback buttons (thumbs up / thumbs
|
|
322
|
+
* down) in the response view. When the user clicks on one of the buttons, the
|
|
323
|
+
* feedback will be sent to your server where you can handle it.
|
|
324
|
+
* @default false
|
|
325
|
+
*/
|
|
326
|
+
feedback?: boolean;
|
|
327
|
+
/**
|
|
328
|
+
* Whether or not to show the retry button in the response view.
|
|
329
|
+
* When the user retries a message, server events will be sent to handle
|
|
330
|
+
* removing thread items and begin generation.
|
|
331
|
+
* @default false
|
|
332
|
+
*/
|
|
333
|
+
retry?: boolean;
|
|
334
|
+
/**
|
|
335
|
+
* Whether or not to show the share button in the response view.
|
|
336
|
+
* When the user clicks on one of the buttons, the "message.share" event
|
|
337
|
+
* will be emitted with the shared content, item ids, and thread id.
|
|
338
|
+
* @default false
|
|
339
|
+
*/
|
|
340
|
+
share?: boolean;
|
|
341
|
+
};
|
|
342
|
+
composer?: {
|
|
343
|
+
/**
|
|
344
|
+
* The placeholder text to show in the composer input.
|
|
345
|
+
* @default "Message the AI"
|
|
346
|
+
*/
|
|
347
|
+
placeholder?: string;
|
|
348
|
+
attachments?: {
|
|
349
|
+
/**
|
|
350
|
+
* Whether file attachments are enabled in the composer.
|
|
351
|
+
*
|
|
352
|
+
* @default false
|
|
353
|
+
*/
|
|
354
|
+
enabled: boolean;
|
|
355
|
+
/**
|
|
356
|
+
* The maximum size of an attachment in bytes.
|
|
357
|
+
*
|
|
358
|
+
* @default 100 * 1024 * 1024 (100MB)
|
|
359
|
+
*/
|
|
360
|
+
maxSize?: number;
|
|
361
|
+
/**
|
|
362
|
+
* The maximum number of attachments that can be sent in a single message.
|
|
363
|
+
*
|
|
364
|
+
* @default 10
|
|
365
|
+
*/
|
|
366
|
+
maxCount?: number;
|
|
367
|
+
/**
|
|
368
|
+
*
|
|
369
|
+
* The MIME types and extensions that are accepted for file uploads,
|
|
370
|
+
* similar to [`showOpenFilePicker`]. When not specified, all MIME types
|
|
371
|
+
* and extensions are accepted.
|
|
372
|
+
*
|
|
373
|
+
* [`showOpenFilePicker`]:
|
|
374
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Window/showOpenFilePicker#accept
|
|
375
|
+
*/
|
|
376
|
+
accept?: Record<string, string[]>;
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* When provided a list of tool options, the user will be able to select a tool
|
|
380
|
+
* from a menu in the composer.
|
|
381
|
+
*/
|
|
382
|
+
tools?: ToolOption[];
|
|
383
|
+
/** A list of models that users can choose from before sending a message. */
|
|
384
|
+
models?: ModelOption[];
|
|
385
|
+
};
|
|
386
|
+
/**
|
|
387
|
+
* Disclaimer text to display below the composer. Supports links with markdown formatting.
|
|
388
|
+
*/
|
|
389
|
+
disclaimer?: {
|
|
390
|
+
text: string;
|
|
391
|
+
highContrast?: boolean;
|
|
392
|
+
};
|
|
393
|
+
entities?: {
|
|
394
|
+
/**
|
|
395
|
+
* Returns a list of entities for the input query.
|
|
396
|
+
* Powers tag autocomplete within the composer.
|
|
397
|
+
*/
|
|
398
|
+
onTagSearch?: (query: string) => Promise<Entity[]>;
|
|
399
|
+
onClick?: (entity: Entity) => void;
|
|
400
|
+
onRequestPreview?: (entity: Entity) => Promise<{
|
|
401
|
+
preview: Widgets.BasicRoot | null;
|
|
402
|
+
}>;
|
|
403
|
+
};
|
|
404
|
+
widgets?: {
|
|
405
|
+
onAction?: (action: {
|
|
406
|
+
type: string;
|
|
407
|
+
payload?: Record<string, unknown>;
|
|
408
|
+
}, widgetItem: {
|
|
409
|
+
id: string;
|
|
410
|
+
widget: Widgets.Card | Widgets.ListView;
|
|
411
|
+
}) => Promise<void>;
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
export declare type ChatKitTheme = {
|
|
416
|
+
/**
|
|
417
|
+
* The color scheme to use for the ChatKit UI.
|
|
418
|
+
* @default "light"
|
|
419
|
+
*/
|
|
420
|
+
colorScheme?: ColorScheme;
|
|
421
|
+
/**
|
|
422
|
+
* Typography
|
|
423
|
+
*/
|
|
424
|
+
typography?: {
|
|
425
|
+
/**
|
|
426
|
+
* Base font size in pixels.
|
|
427
|
+
* @remarks Allowed range: 14-18
|
|
428
|
+
*/
|
|
429
|
+
baseSize?: 14 | 15 | 16 | 17 | 18;
|
|
430
|
+
fontSources?: FontObject[];
|
|
431
|
+
fontFamily?: string;
|
|
432
|
+
fontFamilyMono?: string;
|
|
433
|
+
};
|
|
434
|
+
/**
|
|
435
|
+
* Determines the overall roundness of the ChatKit UI
|
|
436
|
+
*/
|
|
437
|
+
radius?: 'pill' | 'round' | 'soft' | 'sharp';
|
|
438
|
+
/**
|
|
439
|
+
* Determines the overall spacing of the ChatKit UI
|
|
440
|
+
* @default "normal"
|
|
441
|
+
*/
|
|
442
|
+
density?: 'compact' | 'normal' | 'spacious';
|
|
443
|
+
/**
|
|
444
|
+
* Color customization options
|
|
445
|
+
*/
|
|
446
|
+
color?: {
|
|
447
|
+
grayscale?: GrayscaleOptions;
|
|
448
|
+
accent?: AccentColor;
|
|
449
|
+
surface?: SurfaceColors;
|
|
450
|
+
};
|
|
451
|
+
};
|
|
452
|
+
|
|
11
453
|
/**
|
|
12
454
|
* https://js.langchain.com/docs/how_to/streaming/#event-reference
|
|
13
455
|
*/
|
|
@@ -30,7 +472,8 @@ export declare enum ChatMessageEventTypeEnum {
|
|
|
30
472
|
ON_RETRIEVER_ERROR = "on_retriever_error",
|
|
31
473
|
ON_INTERRUPT = "on_interrupt",
|
|
32
474
|
ON_ERROR = "on_error",
|
|
33
|
-
ON_CHAT_EVENT = "on_chat_event"
|
|
475
|
+
ON_CHAT_EVENT = "on_chat_event",
|
|
476
|
+
ON_CLIENT_EFFECT = "on_client_effect"
|
|
34
477
|
}
|
|
35
478
|
|
|
36
479
|
/**
|
|
@@ -74,6 +517,18 @@ export declare enum ChatMessageTypeEnum {
|
|
|
74
517
|
EVENT = "event"
|
|
75
518
|
}
|
|
76
519
|
|
|
520
|
+
export declare type Checkbox = {
|
|
521
|
+
type: 'Checkbox';
|
|
522
|
+
key?: string;
|
|
523
|
+
id?: string;
|
|
524
|
+
name: string;
|
|
525
|
+
label?: string;
|
|
526
|
+
defaultChecked?: boolean;
|
|
527
|
+
onChangeAction?: ActionConfig;
|
|
528
|
+
disabled?: boolean;
|
|
529
|
+
required?: boolean;
|
|
530
|
+
};
|
|
531
|
+
|
|
77
532
|
export declare interface ClientToolMessageInput {
|
|
78
533
|
content: unknown;
|
|
79
534
|
name?: string;
|
|
@@ -90,8 +545,219 @@ export declare interface ClientToolResponse {
|
|
|
90
545
|
toolMessages: ClientToolMessageInput[];
|
|
91
546
|
}
|
|
92
547
|
|
|
548
|
+
export declare interface ClientTools {
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
export declare type Col = {
|
|
552
|
+
type: 'Col';
|
|
553
|
+
key?: string;
|
|
554
|
+
id?: string;
|
|
555
|
+
} & BoxBaseProps;
|
|
556
|
+
|
|
557
|
+
export declare type ColorScheme = 'light' | 'dark';
|
|
558
|
+
|
|
559
|
+
declare type ControlSize = '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
|
|
560
|
+
|
|
561
|
+
declare type ControlVariant = 'solid' | 'soft' | 'outline' | 'ghost';
|
|
562
|
+
|
|
563
|
+
declare type CustomApiConfig = {
|
|
564
|
+
/**
|
|
565
|
+
* The URL (relative or absolute) of the ChatKit API. The configured endpoint
|
|
566
|
+
* must conform to the specification defined in the ChatKit SDK documentation.
|
|
567
|
+
* The easiest way to get started is by using the ChatKit SDK which will help
|
|
568
|
+
* you define your integration in a declarative way.
|
|
569
|
+
*/
|
|
570
|
+
url: string;
|
|
571
|
+
/**
|
|
572
|
+
* Custom fetch function to use for API requests. This is useful for
|
|
573
|
+
* overriding the default fetch behavior, such as adding custom headers or
|
|
574
|
+
* setting credentials.
|
|
575
|
+
*/
|
|
576
|
+
fetch?: typeof fetch;
|
|
577
|
+
/**
|
|
578
|
+
* The domain key that will be used to verify the registered domain
|
|
579
|
+
* for the integration.
|
|
580
|
+
*/
|
|
581
|
+
domainKey: string;
|
|
582
|
+
/**
|
|
583
|
+
* How attachments will be uploaded to your server. Required when attachments are enabled.
|
|
584
|
+
*/
|
|
585
|
+
uploadStrategy?: FileUploadStrategy;
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
export declare type DatePicker = {
|
|
589
|
+
type: 'DatePicker';
|
|
590
|
+
key?: string;
|
|
591
|
+
id?: string;
|
|
592
|
+
name: string;
|
|
593
|
+
onChangeAction?: ActionConfig;
|
|
594
|
+
placeholder?: string;
|
|
595
|
+
defaultValue?: string;
|
|
596
|
+
min?: string;
|
|
597
|
+
max?: string;
|
|
598
|
+
variant?: ControlVariant;
|
|
599
|
+
size?: ControlSize;
|
|
600
|
+
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
601
|
+
align?: 'start' | 'center' | 'end';
|
|
602
|
+
pill?: boolean;
|
|
603
|
+
block?: boolean;
|
|
604
|
+
clearable?: boolean;
|
|
605
|
+
disabled?: boolean;
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
export declare type Divider = {
|
|
609
|
+
type: 'Divider';
|
|
610
|
+
key?: string;
|
|
611
|
+
id?: string;
|
|
612
|
+
color?: string | ThemeColor;
|
|
613
|
+
size?: number | string;
|
|
614
|
+
spacing?: number | string;
|
|
615
|
+
flush?: boolean;
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* A structured object representing a referenceable item such as a
|
|
620
|
+
* person, document, or internal business object.
|
|
621
|
+
*/
|
|
622
|
+
export declare type Entity = {
|
|
623
|
+
/**
|
|
624
|
+
* Human-readable name shown in tags, sources, previews, etc.
|
|
625
|
+
* e.g. "Harry Potter", "Claim #A-1023", "Q2 Planning Doc"
|
|
626
|
+
*/
|
|
627
|
+
title: string;
|
|
628
|
+
id: string;
|
|
629
|
+
/**
|
|
630
|
+
* Optional icon to show when rendering the entity.
|
|
631
|
+
*/
|
|
632
|
+
icon?: string;
|
|
633
|
+
/**
|
|
634
|
+
* Whether the entity is interactive can be clicked or previewed.
|
|
635
|
+
*/
|
|
636
|
+
interactive?: boolean;
|
|
637
|
+
/**
|
|
638
|
+
* Optional human-readable group name to group entities by.
|
|
639
|
+
* e.g. "People", "Documents"
|
|
640
|
+
*/
|
|
641
|
+
group?: string;
|
|
642
|
+
/**
|
|
643
|
+
* Optional metadata that will be proxied to the server if this entity is part of
|
|
644
|
+
* a submitted user message (e.g. in tags) or for client entity callbacks (e.g. for
|
|
645
|
+
* click or preview). This is not directly used in ChatKit.js and can contain
|
|
646
|
+
* arbitrary metadata.
|
|
647
|
+
*/
|
|
648
|
+
data?: Record<string, string>;
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
export declare type EventHandler<K extends keyof ChatKitEvents> = (event: ChatKitEvents[K]) => any;
|
|
652
|
+
|
|
653
|
+
export declare type FileUploadStrategy = {
|
|
654
|
+
type: 'two_phase';
|
|
655
|
+
} | {
|
|
656
|
+
type: 'direct';
|
|
657
|
+
uploadUrl: string;
|
|
658
|
+
};
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Filter out only the allowed options from a Playground config
|
|
662
|
+
*
|
|
663
|
+
* @param options - Full config copied from the playground
|
|
664
|
+
* @returns An object containing only whitelisted options
|
|
665
|
+
*
|
|
666
|
+
* @example
|
|
667
|
+
* ```ts
|
|
668
|
+
* // Config copied from the playground
|
|
669
|
+
* const playgroundConfig = {
|
|
670
|
+
* theme: { colorScheme: 'light', radius: 'pill' },
|
|
671
|
+
* threadItemActions: { feedback: true }, // will be filtered out
|
|
672
|
+
* startScreen: { greeting: 'Hello!' },
|
|
673
|
+
* };
|
|
674
|
+
*
|
|
675
|
+
* const filtered = filterPlaygroundOptions(playgroundConfig);
|
|
676
|
+
* // Result: { theme: { colorScheme: 'light', radius: 'pill' }, startScreen: { greeting: 'Hello!' } }
|
|
677
|
+
* ```
|
|
678
|
+
*/
|
|
679
|
+
export declare function filterPlaygroundOptions<T extends Partial<ChatKitOptions>>(options: T): PlaygroundAllowedOptions;
|
|
680
|
+
|
|
681
|
+
export declare type FontObject = {
|
|
682
|
+
family: string;
|
|
683
|
+
src: string;
|
|
684
|
+
weight?: string | number;
|
|
685
|
+
style?: 'normal' | 'italic' | 'oblique';
|
|
686
|
+
display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
|
|
687
|
+
unicodeRange?: string;
|
|
688
|
+
};
|
|
689
|
+
|
|
690
|
+
export declare type Form = {
|
|
691
|
+
type: 'Form';
|
|
692
|
+
key?: string;
|
|
693
|
+
id?: string;
|
|
694
|
+
onSubmitAction?: ActionConfig;
|
|
695
|
+
direction?: 'row' | 'col';
|
|
696
|
+
} & BoxBaseProps;
|
|
697
|
+
|
|
698
|
+
export declare type GrayscaleOptions = {
|
|
699
|
+
hue: number;
|
|
700
|
+
tint: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
701
|
+
shade?: -4 | -3 | -2 | -1 | 0 | 1 | 2 | 3 | 4;
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
export declare type HeaderIcon = 'sidebar-left' | 'sidebar-right' | 'sidebar-open-left' | 'sidebar-open-right' | 'sidebar-open-left-alt' | 'sidebar-open-right-alt' | 'sidebar-floating-left' | 'sidebar-floating-right' | 'sidebar-floating-open-left' | 'sidebar-floating-open-right' | 'sidebar-collapse-left' | 'sidebar-collapse-right' | 'collapse-left' | 'collapse-right' | 'open-left' | 'open-right' | 'double-chevron-left' | 'double-chevron-right' | 'home' | 'home-alt' | 'back-small' | 'back-large' | 'expand-large' | 'collapse-large' | 'expand-small' | 'collapse-small' | 'star' | 'star-filled' | 'chat-temporary' | 'settings-cog' | 'grid' | 'dots-horizontal' | 'dots-vertical' | 'dots-horizontal-circle' | 'dots-vertical-circle' | 'menu' | 'menu-inverted' | 'hamburger' | 'compose' | 'light-mode' | 'dark-mode' | 'close';
|
|
705
|
+
|
|
706
|
+
declare type HostedApiConfig = {
|
|
707
|
+
/**
|
|
708
|
+
* Function to get a client token or refresh if the current token is expired.
|
|
709
|
+
*/
|
|
710
|
+
getClientSecret: (currentClientSecret: string | null) => Promise<string>;
|
|
711
|
+
};
|
|
712
|
+
|
|
713
|
+
export declare type Icon = {
|
|
714
|
+
type: 'Icon';
|
|
715
|
+
key?: string;
|
|
716
|
+
id?: string;
|
|
717
|
+
name: WidgetIcon;
|
|
718
|
+
color?: string | ThemeColor;
|
|
719
|
+
size?: IconSize;
|
|
720
|
+
};
|
|
721
|
+
|
|
722
|
+
export declare type IconName = 'agent' | 'analytics' | 'atom' | 'batch' | 'bolt' | 'book-open' | 'book-closed' | 'bug' | 'calendar' | 'chart' | 'circle-question' | 'compass' | 'cube' | 'globe' | 'keys' | 'lab' | 'images' | 'lifesaver' | 'lightbulb' | 'map-pin' | 'name' | 'notebook' | 'notebook-pencil' | 'page-blank' | 'profile' | 'profile-card' | 'search' | 'sparkle' | 'sparkle-double' | 'square-code' | 'square-image' | 'square-text' | 'suitcase' | 'write' | 'write-alt' | 'write-alt2';
|
|
723
|
+
|
|
724
|
+
declare type IconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
|
|
725
|
+
|
|
726
|
+
declare type Image_2 = {
|
|
727
|
+
type: 'Image';
|
|
728
|
+
key?: string;
|
|
729
|
+
id?: string;
|
|
730
|
+
src: string;
|
|
731
|
+
alt?: string;
|
|
732
|
+
frame?: boolean;
|
|
733
|
+
fit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none';
|
|
734
|
+
position?: 'top left' | 'top' | 'top right' | 'left' | 'center' | 'right' | 'bottom left' | 'bottom' | 'bottom right';
|
|
735
|
+
flush?: boolean;
|
|
736
|
+
} & BlockProps;
|
|
737
|
+
export { Image_2 as Image }
|
|
738
|
+
|
|
93
739
|
export declare type ImageDetail = "auto" | "low" | "high";
|
|
94
740
|
|
|
741
|
+
export declare type Input = {
|
|
742
|
+
type: 'Input';
|
|
743
|
+
key?: string;
|
|
744
|
+
id?: string;
|
|
745
|
+
name: string;
|
|
746
|
+
inputType?: 'number' | 'email' | 'text' | 'password' | 'tel' | 'url';
|
|
747
|
+
defaultValue?: string;
|
|
748
|
+
required?: boolean;
|
|
749
|
+
pattern?: string;
|
|
750
|
+
placeholder?: string;
|
|
751
|
+
allowAutofillExtensions?: boolean;
|
|
752
|
+
autoSelect?: boolean;
|
|
753
|
+
autoFocus?: boolean;
|
|
754
|
+
disabled?: boolean;
|
|
755
|
+
variant?: 'soft' | 'outline';
|
|
756
|
+
size?: ControlSize;
|
|
757
|
+
gutterSize?: '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
758
|
+
pill?: boolean;
|
|
759
|
+
};
|
|
760
|
+
|
|
95
761
|
/**
|
|
96
762
|
* When an interrupt occurs during task execution, the system generates an InterruptPayload.
|
|
97
763
|
```json
|
|
@@ -141,6 +807,75 @@ export declare interface InterruptPayload {
|
|
|
141
807
|
|
|
142
808
|
export declare function isClientToolRequest(value: any): value is ClientToolRequest;
|
|
143
809
|
|
|
810
|
+
declare type Justification = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly' | 'stretch';
|
|
811
|
+
|
|
812
|
+
export declare type Label = {
|
|
813
|
+
type: 'Label';
|
|
814
|
+
key?: string;
|
|
815
|
+
id?: string;
|
|
816
|
+
value: string;
|
|
817
|
+
fieldName: string;
|
|
818
|
+
size?: TextSize;
|
|
819
|
+
weight?: 'normal' | 'medium' | 'semibold' | 'bold';
|
|
820
|
+
textAlign?: TextAlign;
|
|
821
|
+
color?: string | ThemeColor;
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
export declare type ListView = {
|
|
825
|
+
type: 'ListView';
|
|
826
|
+
key?: string;
|
|
827
|
+
id?: string;
|
|
828
|
+
children: ListViewItem[];
|
|
829
|
+
limit?: number | 'auto';
|
|
830
|
+
status?: WidgetStatus;
|
|
831
|
+
theme?: 'light' | 'dark';
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
export declare type ListViewItem = {
|
|
835
|
+
type: 'ListViewItem';
|
|
836
|
+
key?: string;
|
|
837
|
+
id?: string;
|
|
838
|
+
children: WidgetComponent[];
|
|
839
|
+
onClickAction?: ActionConfig;
|
|
840
|
+
gap?: number | string;
|
|
841
|
+
align?: Alignment;
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
export declare type Markdown = {
|
|
845
|
+
type: 'Markdown';
|
|
846
|
+
key?: string;
|
|
847
|
+
id?: string;
|
|
848
|
+
value: string;
|
|
849
|
+
streaming?: boolean;
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* Merge Playground config with local config
|
|
854
|
+
* Playground config overrides matching items in local config (whitelist only)
|
|
855
|
+
*
|
|
856
|
+
* @param localOptions - Base config in the local project (can include onClientTool, header, etc.)
|
|
857
|
+
* @param playgroundOptions - Config copied from the playground
|
|
858
|
+
* @returns Merged config
|
|
859
|
+
*
|
|
860
|
+
* @example
|
|
861
|
+
* ```ts
|
|
862
|
+
* const localConfig = {
|
|
863
|
+
* api: { getClientSecret: async () => '...' },
|
|
864
|
+
* onClientTool: async () => { ... }, // kept
|
|
865
|
+
* header: { enabled: true }, // kept
|
|
866
|
+
* };
|
|
867
|
+
*
|
|
868
|
+
* const playgroundConfig = {
|
|
869
|
+
* theme: { colorScheme: 'dark' },
|
|
870
|
+
* threadItemActions: { feedback: true }, // filtered out
|
|
871
|
+
* };
|
|
872
|
+
*
|
|
873
|
+
* const merged = mergeWithPlaygroundOptions(localConfig, playgroundConfig);
|
|
874
|
+
* // Result: { api, onClientTool, header, theme }
|
|
875
|
+
* ```
|
|
876
|
+
*/
|
|
877
|
+
export declare function mergeWithPlaygroundOptions<T extends Partial<ChatKitOptions>>(localOptions: T, playgroundOptions: Partial<ChatKitOptions>): T & PlaygroundAllowedOptions;
|
|
878
|
+
|
|
144
879
|
export declare type MessageContentImageUrl = {
|
|
145
880
|
type: "image_url";
|
|
146
881
|
image_url: string | {
|
|
@@ -154,6 +889,114 @@ export declare type MessageContentText = {
|
|
|
154
889
|
text: string;
|
|
155
890
|
};
|
|
156
891
|
|
|
892
|
+
export declare type ModelOption = {
|
|
893
|
+
/** Identifier used when submitting a message. */
|
|
894
|
+
id: string;
|
|
895
|
+
/** Label displayed in the model picker. */
|
|
896
|
+
label: string;
|
|
897
|
+
/** Optional helper text shown with the option. */
|
|
898
|
+
description?: string;
|
|
899
|
+
/** When true the option is visible but cannot be selected. */
|
|
900
|
+
disabled?: boolean;
|
|
901
|
+
/** Determines if the model should be the default selected option. */
|
|
902
|
+
default?: boolean;
|
|
903
|
+
};
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* Playground configuration whitelist - only allow these options to take effect when copied from the playground
|
|
907
|
+
* Filters out: locale, initialThread, header, history, threadItemActions, disclaimer, entities, widgets, onClientTool
|
|
908
|
+
*/
|
|
909
|
+
/**
|
|
910
|
+
* Options allowed to be configured from Playground
|
|
911
|
+
*/
|
|
912
|
+
export declare type PlaygroundAllowedOptions = {
|
|
913
|
+
api?: ChatKitOptions['api'];
|
|
914
|
+
theme?: ColorScheme | ChatKitTheme;
|
|
915
|
+
composer?: ChatKitOptions['composer'];
|
|
916
|
+
startScreen?: ChatKitOptions['startScreen'];
|
|
917
|
+
};
|
|
918
|
+
|
|
919
|
+
export declare type RadioGroup = {
|
|
920
|
+
type: 'RadioGroup';
|
|
921
|
+
key?: string;
|
|
922
|
+
id?: string;
|
|
923
|
+
name: string;
|
|
924
|
+
options?: {
|
|
925
|
+
label: string;
|
|
926
|
+
value: string;
|
|
927
|
+
disabled?: boolean;
|
|
928
|
+
}[];
|
|
929
|
+
ariaLabel?: string;
|
|
930
|
+
onChangeAction?: ActionConfig;
|
|
931
|
+
defaultValue?: string;
|
|
932
|
+
direction?: 'row' | 'col';
|
|
933
|
+
disabled?: boolean;
|
|
934
|
+
required?: boolean;
|
|
935
|
+
};
|
|
936
|
+
|
|
937
|
+
declare type RadiusValue = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | 'full' | '100%' | 'none';
|
|
938
|
+
|
|
939
|
+
export declare type Row = {
|
|
940
|
+
type: 'Row';
|
|
941
|
+
key?: string;
|
|
942
|
+
id?: string;
|
|
943
|
+
} & BoxBaseProps;
|
|
944
|
+
|
|
945
|
+
export declare type Select = {
|
|
946
|
+
type: 'Select';
|
|
947
|
+
key?: string;
|
|
948
|
+
id?: string;
|
|
949
|
+
name: string;
|
|
950
|
+
options: {
|
|
951
|
+
value: string;
|
|
952
|
+
label: string;
|
|
953
|
+
}[];
|
|
954
|
+
onChangeAction?: ActionConfig;
|
|
955
|
+
placeholder?: string;
|
|
956
|
+
defaultValue?: string;
|
|
957
|
+
variant?: ControlVariant;
|
|
958
|
+
size?: ControlSize;
|
|
959
|
+
pill?: boolean;
|
|
960
|
+
block?: boolean;
|
|
961
|
+
clearable?: boolean;
|
|
962
|
+
disabled?: boolean;
|
|
963
|
+
};
|
|
964
|
+
|
|
965
|
+
export declare type Spacer = {
|
|
966
|
+
type: 'Spacer';
|
|
967
|
+
key?: string;
|
|
968
|
+
id?: string;
|
|
969
|
+
minSize?: number | string;
|
|
970
|
+
};
|
|
971
|
+
|
|
972
|
+
declare type Spacing = {
|
|
973
|
+
top?: number | string;
|
|
974
|
+
right?: number | string;
|
|
975
|
+
bottom?: number | string;
|
|
976
|
+
left?: number | string;
|
|
977
|
+
x?: number | string;
|
|
978
|
+
y?: number | string;
|
|
979
|
+
};
|
|
980
|
+
|
|
981
|
+
export declare type StartScreenPrompt = {
|
|
982
|
+
label: string;
|
|
983
|
+
prompt: string;
|
|
984
|
+
icon?: IconName;
|
|
985
|
+
};
|
|
986
|
+
|
|
987
|
+
export declare const STATE_VARIABLE_HUMAN = "human";
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* All locales that are accepted by ChatKit without falling back to English.
|
|
991
|
+
* Includes language codes that are resolved by ChatKit to a translated locale.
|
|
992
|
+
*/
|
|
993
|
+
export declare type SupportedLocale = TranslatedLocale | 'bg' | 'bn' | 'bs' | 'ca' | 'cs' | 'da' | 'de' | 'el' | 'es' | 'et' | 'fi' | 'fr' | 'gu' | 'hi' | 'hr' | 'hu' | 'hy' | 'id' | 'is' | 'it' | 'ja' | 'ka' | 'kn' | 'ko' | 'lv' | 'mk' | 'mr' | 'ms' | 'my' | 'nb' | 'nl' | 'pl' | 'pt' | 'ro' | 'ru' | 'sk' | 'sl' | 'so' | 'sq' | 'sr' | 'sv' | 'sw' | 'ta' | 'te' | 'th' | 'tr' | 'uk' | 'vi' | 'zh' | 'zh-Hant' | 'en';
|
|
994
|
+
|
|
995
|
+
export declare type SurfaceColors = {
|
|
996
|
+
background: string;
|
|
997
|
+
foreground: string;
|
|
998
|
+
};
|
|
999
|
+
|
|
157
1000
|
/**
|
|
158
1001
|
* Data type for chat event message
|
|
159
1002
|
*/
|
|
@@ -172,6 +1015,120 @@ export declare type TChatEventMessage = {
|
|
|
172
1015
|
*/
|
|
173
1016
|
export declare type TChatMessageStep<T = any> = TMessageComponent<TMessageComponentStep<T>>;
|
|
174
1017
|
|
|
1018
|
+
export declare type TChatRequest = {
|
|
1019
|
+
/**
|
|
1020
|
+
* The human input, include parameters
|
|
1021
|
+
*/
|
|
1022
|
+
input: TChatRequestHuman;
|
|
1023
|
+
/**
|
|
1024
|
+
* Custom graph state
|
|
1025
|
+
*/
|
|
1026
|
+
state?: {
|
|
1027
|
+
[STATE_VARIABLE_HUMAN]: TChatRequestHuman;
|
|
1028
|
+
} & Record<string, any>;
|
|
1029
|
+
agentKey?: string;
|
|
1030
|
+
projectId?: string;
|
|
1031
|
+
conversationId?: string;
|
|
1032
|
+
environmentId?: string;
|
|
1033
|
+
id?: string;
|
|
1034
|
+
executionId?: string;
|
|
1035
|
+
confirm?: boolean;
|
|
1036
|
+
command?: TInterruptCommand;
|
|
1037
|
+
retry?: boolean;
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
/**
|
|
1041
|
+
* Human input message, include parameters and attachments
|
|
1042
|
+
*/
|
|
1043
|
+
export declare type TChatRequestHuman = {
|
|
1044
|
+
input?: string;
|
|
1045
|
+
files?: Partial<File>[];
|
|
1046
|
+
[key: string]: unknown;
|
|
1047
|
+
};
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* Data type for client effect message
|
|
1051
|
+
*/
|
|
1052
|
+
export declare type TClientEeffectMessage = {
|
|
1053
|
+
name: string;
|
|
1054
|
+
args: Record<string, any>;
|
|
1055
|
+
tool_call_id?: string;
|
|
1056
|
+
agentKey?: string;
|
|
1057
|
+
created_date?: Date | string;
|
|
1058
|
+
};
|
|
1059
|
+
|
|
1060
|
+
declare type TextAlign = 'start' | 'center' | 'end';
|
|
1061
|
+
|
|
1062
|
+
export declare type Textarea = {
|
|
1063
|
+
type: 'Textarea';
|
|
1064
|
+
key?: string;
|
|
1065
|
+
id?: string;
|
|
1066
|
+
name: string;
|
|
1067
|
+
defaultValue?: string;
|
|
1068
|
+
required?: boolean;
|
|
1069
|
+
pattern?: string;
|
|
1070
|
+
placeholder?: string;
|
|
1071
|
+
autoSelect?: boolean;
|
|
1072
|
+
autoFocus?: boolean;
|
|
1073
|
+
disabled?: boolean;
|
|
1074
|
+
variant?: 'soft' | 'outline';
|
|
1075
|
+
size?: ControlSize;
|
|
1076
|
+
gutterSize?: '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
1077
|
+
rows?: number;
|
|
1078
|
+
autoResize?: boolean;
|
|
1079
|
+
maxRows?: number;
|
|
1080
|
+
allowAutofillExtensions?: boolean;
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
export declare type TextComponent = {
|
|
1084
|
+
type: 'Text';
|
|
1085
|
+
key?: string;
|
|
1086
|
+
id?: string;
|
|
1087
|
+
value: string;
|
|
1088
|
+
streaming?: boolean;
|
|
1089
|
+
italic?: boolean;
|
|
1090
|
+
lineThrough?: boolean;
|
|
1091
|
+
width?: number | string;
|
|
1092
|
+
size?: TextSize;
|
|
1093
|
+
minLines?: number;
|
|
1094
|
+
editable?: false | {
|
|
1095
|
+
name: string;
|
|
1096
|
+
autoFocus?: boolean;
|
|
1097
|
+
autoSelect?: boolean;
|
|
1098
|
+
autoComplete?: string;
|
|
1099
|
+
allowAutofillExtensions?: boolean;
|
|
1100
|
+
pattern?: string;
|
|
1101
|
+
placeholder?: string;
|
|
1102
|
+
required?: boolean;
|
|
1103
|
+
};
|
|
1104
|
+
} & BaseTextProps;
|
|
1105
|
+
|
|
1106
|
+
declare type TextSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
1107
|
+
|
|
1108
|
+
declare type ThemeColor = {
|
|
1109
|
+
dark: string;
|
|
1110
|
+
light: string;
|
|
1111
|
+
};
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* Command to resume with streaming after human decision
|
|
1115
|
+
*/
|
|
1116
|
+
export declare type TInterruptCommand = {
|
|
1117
|
+
resume?: any;
|
|
1118
|
+
update?: any;
|
|
1119
|
+
toolCalls?: ToolCall[];
|
|
1120
|
+
agentKey?: string;
|
|
1121
|
+
};
|
|
1122
|
+
|
|
1123
|
+
export declare type Title = {
|
|
1124
|
+
type: 'Title';
|
|
1125
|
+
key?: string;
|
|
1126
|
+
id?: string;
|
|
1127
|
+
size?: TitleSize;
|
|
1128
|
+
} & BaseTextProps;
|
|
1129
|
+
|
|
1130
|
+
declare type TitleSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl';
|
|
1131
|
+
|
|
175
1132
|
/**
|
|
176
1133
|
* Defines the data type of the sub-message of `component` type in the message `content` {@link MessageContentComplex}
|
|
177
1134
|
*/
|
|
@@ -208,6 +1165,21 @@ export declare type TMessageComponentStep<T = unknown> = {
|
|
|
208
1165
|
artifact?: any;
|
|
209
1166
|
};
|
|
210
1167
|
|
|
1168
|
+
export declare type TMessageComponentWidget = TMessageComponent<TMessageComponentWidgetData>;
|
|
1169
|
+
|
|
1170
|
+
export declare type TMessageComponentWidgetData = {
|
|
1171
|
+
type: 'Widget';
|
|
1172
|
+
mode?: string;
|
|
1173
|
+
widgets: TMessageComponentWidgetItem[];
|
|
1174
|
+
executionId?: string;
|
|
1175
|
+
};
|
|
1176
|
+
|
|
1177
|
+
export declare type TMessageComponentWidgetItem = {
|
|
1178
|
+
name: string;
|
|
1179
|
+
config: Types.Surface;
|
|
1180
|
+
values?: Record<string, unknown>;
|
|
1181
|
+
};
|
|
1182
|
+
|
|
211
1183
|
/**
|
|
212
1184
|
* Enhance {@link MessageContent} in Langchain.js
|
|
213
1185
|
*
|
|
@@ -263,6 +1235,206 @@ export declare type TMessageContentText = {
|
|
|
263
1235
|
text: string;
|
|
264
1236
|
};
|
|
265
1237
|
|
|
1238
|
+
export declare type TMessageContentWidget = TMessageContentComponent<TMessageComponentWidgetData>;
|
|
1239
|
+
|
|
266
1240
|
export declare type TMessageItems = TMessageContentComplex[];
|
|
267
1241
|
|
|
1242
|
+
export declare type ToolOption = {
|
|
1243
|
+
id: string;
|
|
1244
|
+
/** Label displayed in the tool menu */
|
|
1245
|
+
label: string;
|
|
1246
|
+
/** Label displayed in the button when the tool is selected. */
|
|
1247
|
+
shortLabel?: string;
|
|
1248
|
+
/** Placeholder text to show in the composer input when the tool is selected. */
|
|
1249
|
+
placeholderOverride?: string;
|
|
1250
|
+
/**
|
|
1251
|
+
* Icon displayed next to the tool in the menu.
|
|
1252
|
+
*/
|
|
1253
|
+
icon: IconName;
|
|
1254
|
+
/**
|
|
1255
|
+
* Whether the tool is pinned to the composer outside of the tool menu.
|
|
1256
|
+
*
|
|
1257
|
+
* @default false
|
|
1258
|
+
*/
|
|
1259
|
+
pinned?: boolean;
|
|
1260
|
+
};
|
|
1261
|
+
|
|
1262
|
+
export declare type Transition = {
|
|
1263
|
+
type: 'Transition';
|
|
1264
|
+
key?: string;
|
|
1265
|
+
id?: string;
|
|
1266
|
+
children: WidgetComponent;
|
|
1267
|
+
};
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* All locales for which there is an actual translation file.
|
|
1271
|
+
*/
|
|
1272
|
+
export declare type TranslatedLocale = 'am' | 'ar' | 'bg-BG' | 'bn-BD' | 'bs-BA' | 'ca-ES' | 'cs-CZ' | 'da-DK' | 'de-DE' | 'el-GR' | 'es-419' | 'es-ES' | 'et-EE' | 'fi-FI' | 'fr-CA' | 'fr-FR' | 'gu-IN' | 'hi-IN' | 'hr-HR' | 'hu-HU' | 'hy-AM' | 'id-ID' | 'is-IS' | 'it-IT' | 'ja-JP' | 'ka-GE' | 'kk' | 'kn-IN' | 'ko-KR' | 'lt' | 'lv-LV' | 'mk-MK' | 'ml' | 'mn' | 'mr-IN' | 'ms-MY' | 'my-MM' | 'nb-NO' | 'nl-NL' | 'pa' | 'pl-PL' | 'pt-BR' | 'pt-PT' | 'ro-RO' | 'ru-RU' | 'sk-SK' | 'sl-SI' | 'so-SO' | 'sq-AL' | 'sr-RS' | 'sv-SE' | 'sw-TZ' | 'ta-IN' | 'te-IN' | 'th-TH' | 'tl' | 'tr-TR' | 'uk-UA' | 'ur' | 'vi-VN' | 'zh-CN' | 'zh-HK' | 'zh-TW';
|
|
1273
|
+
|
|
1274
|
+
export declare type WidgetComponent = TextComponent | Title | Caption | Badge | Markdown | Box | Row | Col | Divider | Icon | Image_2 | Button | Checkbox | Spacer | Select | DatePicker | Form | Input | Label | RadioGroup | Textarea | Transition;
|
|
1275
|
+
|
|
1276
|
+
export declare type WidgetIcon = 'agent' | 'analytics' | 'atom' | 'batch' | 'bolt' | 'book-open' | 'book-closed' | 'book-clock' | 'bug' | 'calendar' | 'chart' | 'check' | 'check-circle' | 'check-circle-filled' | 'chevron-left' | 'chevron-right' | 'circle-question' | 'compass' | 'confetti' | 'cube' | 'desktop' | 'document' | 'dot' | 'dots-horizontal' | 'dots-vertical' | 'empty-circle' | 'external-link' | 'globe' | 'keys' | 'lab' | 'images' | 'info' | 'lifesaver' | 'lightbulb' | 'mail' | 'map-pin' | 'maps' | 'mobile' | 'name' | 'notebook' | 'notebook-pencil' | 'page-blank' | 'phone' | 'play' | 'plus' | 'profile' | 'profile-card' | 'reload' | 'star' | 'star-filled' | 'search' | 'sparkle' | 'sparkle-double' | 'square-code' | 'square-image' | 'square-text' | 'suitcase' | 'settings-slider' | 'user' | 'wreath' | 'write' | 'write-alt' | 'write-alt2';
|
|
1277
|
+
|
|
1278
|
+
export declare type WidgetRoot = Card | ListView | BasicRoot;
|
|
1279
|
+
|
|
1280
|
+
declare namespace Widgets {
|
|
1281
|
+
export {
|
|
1282
|
+
WidgetRoot,
|
|
1283
|
+
WidgetComponent,
|
|
1284
|
+
BasicRoot,
|
|
1285
|
+
Card,
|
|
1286
|
+
ListView,
|
|
1287
|
+
ListViewItem,
|
|
1288
|
+
Box,
|
|
1289
|
+
Row,
|
|
1290
|
+
Col,
|
|
1291
|
+
Form,
|
|
1292
|
+
Spacer,
|
|
1293
|
+
Divider,
|
|
1294
|
+
Transition,
|
|
1295
|
+
Title,
|
|
1296
|
+
Caption,
|
|
1297
|
+
TextComponent,
|
|
1298
|
+
Markdown,
|
|
1299
|
+
Badge,
|
|
1300
|
+
Icon,
|
|
1301
|
+
Image_2 as Image,
|
|
1302
|
+
Button,
|
|
1303
|
+
Input,
|
|
1304
|
+
Textarea,
|
|
1305
|
+
Select,
|
|
1306
|
+
DatePicker,
|
|
1307
|
+
Checkbox,
|
|
1308
|
+
RadioGroup,
|
|
1309
|
+
Label,
|
|
1310
|
+
WidgetIcon
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
declare type WidgetStatus = {
|
|
1315
|
+
text: string;
|
|
1316
|
+
favicon?: string;
|
|
1317
|
+
frame?: boolean;
|
|
1318
|
+
} | {
|
|
1319
|
+
text: string;
|
|
1320
|
+
icon?: WidgetIcon;
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1323
|
+
/**
|
|
1324
|
+
* A Web Component that serves as the entry point for a ChatKit integration.
|
|
1325
|
+
* * @noInheritDoc
|
|
1326
|
+
*/
|
|
1327
|
+
export declare interface XpertAIChatKit extends HTMLElement {
|
|
1328
|
+
/**
|
|
1329
|
+
* Applies configuration options to the ChatKit instance.
|
|
1330
|
+
*
|
|
1331
|
+
* **IMPORTANT**: New options are not merged with the existing options. You must provide a full set of options every time you call this method.
|
|
1332
|
+
*/
|
|
1333
|
+
setOptions(options: ChatKitOptions): void;
|
|
1334
|
+
/** Focuses the composer input field. */
|
|
1335
|
+
focusComposer(): Promise<void>;
|
|
1336
|
+
/** Changes the active thread. Pass `null` to switch to a new thread. */
|
|
1337
|
+
setThreadId(threadId: string | null): Promise<void>;
|
|
1338
|
+
/**
|
|
1339
|
+
* Sends a custom application-defined action to your backend.
|
|
1340
|
+
*/
|
|
1341
|
+
sendCustomAction(action: {
|
|
1342
|
+
type: string;
|
|
1343
|
+
payload?: Record<string, unknown>;
|
|
1344
|
+
},
|
|
1345
|
+
/**
|
|
1346
|
+
* The ID of the WidgetItem that the action is associated with. You may
|
|
1347
|
+
* need this if the action was triggered by a widget, gets handled
|
|
1348
|
+
* client-side, and then you want to send the action back to the server to
|
|
1349
|
+
* do additional handling.
|
|
1350
|
+
*
|
|
1351
|
+
* @example
|
|
1352
|
+
* ```ts
|
|
1353
|
+
* chatKit.options = {
|
|
1354
|
+
* // other options...
|
|
1355
|
+
* widgets: {
|
|
1356
|
+
* async onAction(action, widgetItem) {
|
|
1357
|
+
* await someClientSideHandling(action)
|
|
1358
|
+
* await chatkit.sendAction(action, widgetItem.id)
|
|
1359
|
+
* }
|
|
1360
|
+
* }
|
|
1361
|
+
* }
|
|
1362
|
+
* ```
|
|
1363
|
+
*/
|
|
1364
|
+
itemId?: string): Promise<void>;
|
|
1365
|
+
/** Sends a user message. */
|
|
1366
|
+
sendUserMessage(params: {
|
|
1367
|
+
text: string;
|
|
1368
|
+
reply?: string;
|
|
1369
|
+
attachments?: Attachment[];
|
|
1370
|
+
newThread?: boolean;
|
|
1371
|
+
}): Promise<void>;
|
|
1372
|
+
/** Sets the composer's content without sending a message. */
|
|
1373
|
+
setComposerValue(params: {
|
|
1374
|
+
text: string;
|
|
1375
|
+
reply?: string;
|
|
1376
|
+
attachments?: Attachment[];
|
|
1377
|
+
}): Promise<void>;
|
|
1378
|
+
/**
|
|
1379
|
+
* Manually fetches updates from the server.
|
|
1380
|
+
*
|
|
1381
|
+
* Use this when you've manually updated the thread or thread items and need to sync them with the client.
|
|
1382
|
+
*/
|
|
1383
|
+
fetchUpdates(): Promise<void>;
|
|
1384
|
+
/**
|
|
1385
|
+
* Adds an event listener for the specified {@link ChatKitEvents} event.
|
|
1386
|
+
*
|
|
1387
|
+
* @example
|
|
1388
|
+
* ```ts
|
|
1389
|
+
* chatKit.addEventListener('chatkit.error', (event) => {
|
|
1390
|
+
* logToMyErrorLogger(event.detail.error);
|
|
1391
|
+
* });
|
|
1392
|
+
* ```
|
|
1393
|
+
*
|
|
1394
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener}
|
|
1395
|
+
*/
|
|
1396
|
+
addEventListener<K extends keyof ChatKitEvents>(
|
|
1397
|
+
/**
|
|
1398
|
+
* See {@link ChatKitEvents} for available events.
|
|
1399
|
+
*/
|
|
1400
|
+
type: K,
|
|
1401
|
+
/**
|
|
1402
|
+
* The event listener callback.
|
|
1403
|
+
*/
|
|
1404
|
+
listener: EventHandler<K>,
|
|
1405
|
+
/**
|
|
1406
|
+
* An object that specifies characteristics about the event listener.
|
|
1407
|
+
*
|
|
1408
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#options}
|
|
1409
|
+
*/
|
|
1410
|
+
options?: boolean | AddEventListenerOptions): void;
|
|
1411
|
+
/* Excluded from this release type: addEventListener */
|
|
1412
|
+
/**
|
|
1413
|
+
* Removes an event listener for the specified event.
|
|
1414
|
+
*
|
|
1415
|
+
* @example
|
|
1416
|
+
* ```ts
|
|
1417
|
+
* chatKit.removeEventListener('chatkit.error', myErrorListener);
|
|
1418
|
+
* ```
|
|
1419
|
+
*
|
|
1420
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener}
|
|
1421
|
+
*/
|
|
1422
|
+
removeEventListener<K extends keyof ChatKitEvents>(
|
|
1423
|
+
/**
|
|
1424
|
+
* See {@link ChatKitEvents} for available events.
|
|
1425
|
+
*/
|
|
1426
|
+
type: K,
|
|
1427
|
+
/**
|
|
1428
|
+
* The event listener callback to remove.
|
|
1429
|
+
*/
|
|
1430
|
+
listener: EventHandler<K>,
|
|
1431
|
+
/**
|
|
1432
|
+
* An object that specifies characteristics about the event listener.
|
|
1433
|
+
*
|
|
1434
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener#options}
|
|
1435
|
+
*/
|
|
1436
|
+
options?: boolean | EventListenerOptions): void;
|
|
1437
|
+
/* Excluded from this release type: removeEventListener */
|
|
1438
|
+
}
|
|
1439
|
+
|
|
268
1440
|
export { }
|