@xpert-ai/chatkit-types 0.0.3 → 0.0.5
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 +1324 -89
- package/dist/index.js +2150 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,34 +1,479 @@
|
|
|
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
|
+
};
|
|
224
|
+
|
|
1
225
|
export declare interface ChatkitMessage {
|
|
2
|
-
status?: string
|
|
3
|
-
content: TMessageItems
|
|
4
|
-
reasoning?: TMessageContentReasoning[]
|
|
5
|
-
type: 'user' | 'assistant' | 'system' | 'tool' | 'event'
|
|
6
|
-
id: string
|
|
226
|
+
status?: string;
|
|
227
|
+
content: TMessageItems;
|
|
228
|
+
reasoning?: TMessageContentReasoning[];
|
|
229
|
+
type: 'user' | 'assistant' | 'system' | 'tool' | 'event';
|
|
230
|
+
id: string;
|
|
7
231
|
}
|
|
8
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
|
+
|
|
9
453
|
/**
|
|
10
454
|
* https://js.langchain.com/docs/how_to/streaming/#event-reference
|
|
11
455
|
*/
|
|
12
456
|
export declare enum ChatMessageEventTypeEnum {
|
|
13
|
-
ON_CONVERSATION_START =
|
|
14
|
-
ON_CONVERSATION_END =
|
|
15
|
-
ON_MESSAGE_START =
|
|
16
|
-
ON_MESSAGE_END =
|
|
17
|
-
ON_TOOL_START =
|
|
18
|
-
ON_TOOL_END =
|
|
19
|
-
ON_TOOL_ERROR =
|
|
457
|
+
ON_CONVERSATION_START = "on_conversation_start",
|
|
458
|
+
ON_CONVERSATION_END = "on_conversation_end",
|
|
459
|
+
ON_MESSAGE_START = "on_message_start",
|
|
460
|
+
ON_MESSAGE_END = "on_message_end",
|
|
461
|
+
ON_TOOL_START = "on_tool_start",
|
|
462
|
+
ON_TOOL_END = "on_tool_end",
|
|
463
|
+
ON_TOOL_ERROR = "on_tool_error",
|
|
20
464
|
/**
|
|
21
465
|
* Step message in tool call
|
|
22
466
|
*/
|
|
23
|
-
ON_TOOL_MESSAGE =
|
|
24
|
-
ON_AGENT_START =
|
|
25
|
-
ON_AGENT_END =
|
|
26
|
-
ON_RETRIEVER_START =
|
|
27
|
-
ON_RETRIEVER_END =
|
|
28
|
-
ON_RETRIEVER_ERROR =
|
|
29
|
-
ON_INTERRUPT =
|
|
30
|
-
ON_ERROR =
|
|
31
|
-
ON_CHAT_EVENT =
|
|
467
|
+
ON_TOOL_MESSAGE = "on_tool_message",
|
|
468
|
+
ON_AGENT_START = "on_agent_start",
|
|
469
|
+
ON_AGENT_END = "on_agent_end",
|
|
470
|
+
ON_RETRIEVER_START = "on_retriever_start",
|
|
471
|
+
ON_RETRIEVER_END = "on_retriever_end",
|
|
472
|
+
ON_RETRIEVER_ERROR = "on_retriever_error",
|
|
473
|
+
ON_INTERRUPT = "on_interrupt",
|
|
474
|
+
ON_ERROR = "on_error",
|
|
475
|
+
ON_CHAT_EVENT = "on_chat_event",
|
|
476
|
+
ON_CLIENT_EFFECT = "on_client_effect"
|
|
32
477
|
}
|
|
33
478
|
|
|
34
479
|
/**
|
|
@@ -38,46 +483,399 @@ export declare enum ChatMessageStepCategory {
|
|
|
38
483
|
/**
|
|
39
484
|
* List of items: urls, files, etc.
|
|
40
485
|
*/
|
|
41
|
-
List =
|
|
486
|
+
List = "list",
|
|
42
487
|
/**
|
|
43
488
|
* Websearch results
|
|
44
489
|
*/
|
|
45
|
-
WebSearch =
|
|
490
|
+
WebSearch = "web_search",
|
|
46
491
|
/**
|
|
47
492
|
* Files list
|
|
48
493
|
*/
|
|
49
|
-
Files =
|
|
494
|
+
Files = "files",
|
|
50
495
|
/**
|
|
51
496
|
* View a file
|
|
52
497
|
*/
|
|
53
|
-
File =
|
|
498
|
+
File = "file",
|
|
54
499
|
/**
|
|
55
500
|
* Program Execution
|
|
56
501
|
*/
|
|
57
|
-
Program =
|
|
502
|
+
Program = "program",
|
|
58
503
|
/**
|
|
59
504
|
* Iframe
|
|
60
505
|
*/
|
|
61
|
-
Iframe =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
Tasks = 'tasks',
|
|
66
|
-
|
|
506
|
+
Iframe = "iframe",
|
|
507
|
+
Memory = "memory",
|
|
508
|
+
Tasks = "tasks",
|
|
67
509
|
/**
|
|
68
510
|
* Knowledges (knowledge base retriever results)
|
|
69
511
|
*/
|
|
70
|
-
Knowledges =
|
|
512
|
+
Knowledges = "knowledges"
|
|
71
513
|
}
|
|
72
514
|
|
|
73
515
|
export declare enum ChatMessageTypeEnum {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
516
|
+
MESSAGE = "message",
|
|
517
|
+
EVENT = "event"
|
|
518
|
+
}
|
|
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
|
+
|
|
532
|
+
export declare interface ClientToolMessageInput {
|
|
533
|
+
content: unknown;
|
|
534
|
+
name?: string;
|
|
535
|
+
tool_call_id?: string;
|
|
536
|
+
status?: 'success' | 'error';
|
|
537
|
+
artifact?: unknown;
|
|
77
538
|
}
|
|
78
539
|
|
|
540
|
+
export declare interface ClientToolRequest {
|
|
541
|
+
clientToolCalls: ToolCall[];
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export declare interface ClientToolResponse {
|
|
545
|
+
toolMessages: ClientToolMessageInput[];
|
|
546
|
+
}
|
|
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
|
+
* 从 Playground 复制的配置中过滤出允许的配置项
|
|
662
|
+
*
|
|
663
|
+
* @param options - 从 playground 复制的完整配置
|
|
664
|
+
* @returns 只包含白名单配置项的对象
|
|
665
|
+
*
|
|
666
|
+
* @example
|
|
667
|
+
* ```ts
|
|
668
|
+
* // 从 playground 复制的配置
|
|
669
|
+
* const playgroundConfig = {
|
|
670
|
+
* theme: { colorScheme: 'light', radius: 'pill' },
|
|
671
|
+
* threadItemActions: { feedback: true }, // 会被过滤掉
|
|
672
|
+
* startScreen: { greeting: 'Hello!' },
|
|
673
|
+
* };
|
|
674
|
+
*
|
|
675
|
+
* const filtered = filterPlaygroundOptions(playgroundConfig);
|
|
676
|
+
* // 结果: { 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
|
+
|
|
79
739
|
export declare type ImageDetail = "auto" | "low" | "high";
|
|
80
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
|
+
|
|
761
|
+
/**
|
|
762
|
+
* When an interrupt occurs during task execution, the system generates an InterruptPayload.
|
|
763
|
+
```json
|
|
764
|
+
{
|
|
765
|
+
"type": "event",
|
|
766
|
+
"event": "on_interrupt",
|
|
767
|
+
"data": {
|
|
768
|
+
"tasks": [
|
|
769
|
+
{
|
|
770
|
+
"id": "9c4d2ac5-8808-5b6f-855c-4d48aa3d77a7",
|
|
771
|
+
"name": "Middleware_wPzR2bIXqE_after_model",
|
|
772
|
+
"path": ["__pregel_pull", "Middleware_wPzR2bIXqE_after_model"],
|
|
773
|
+
"interrupts": [
|
|
774
|
+
{
|
|
775
|
+
"id": "b42f7887d65e57ed11cf08b8927763db",
|
|
776
|
+
"value": {
|
|
777
|
+
"toolCalls": [
|
|
778
|
+
{
|
|
779
|
+
"name": "getUserStation",
|
|
780
|
+
"args": {
|
|
781
|
+
"input": "Query the site selected by the user"
|
|
782
|
+
},
|
|
783
|
+
"id": "call_00_swcaUjIaACXOHHaZyNmQB3Vm",
|
|
784
|
+
"type": "tool_call"
|
|
785
|
+
}
|
|
786
|
+
]
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
]
|
|
790
|
+
}
|
|
791
|
+
]
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
```
|
|
795
|
+
*/
|
|
796
|
+
export declare interface InterruptPayload {
|
|
797
|
+
tasks: Array<{
|
|
798
|
+
id: string;
|
|
799
|
+
name: string;
|
|
800
|
+
path: string[];
|
|
801
|
+
interrupts: Array<{
|
|
802
|
+
id: string;
|
|
803
|
+
value: ClientToolRequest;
|
|
804
|
+
}>;
|
|
805
|
+
}>;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
export declare function isClientToolRequest(value: any): value is ClientToolRequest;
|
|
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
|
+
* 合并 Playground 配置与本地配置
|
|
854
|
+
* Playground 配置会覆盖本地配置中的对应项(只限白名单内的配置)
|
|
855
|
+
*
|
|
856
|
+
* @param localOptions - 本地项目中的基础配置(可包含 onClientTool, header 等)
|
|
857
|
+
* @param playgroundOptions - 从 playground 复制的配置
|
|
858
|
+
* @returns 合并后的配置
|
|
859
|
+
*
|
|
860
|
+
* @example
|
|
861
|
+
* ```ts
|
|
862
|
+
* const localConfig = {
|
|
863
|
+
* api: { getClientSecret: async () => '...' },
|
|
864
|
+
* onClientTool: async () => { ... }, // 保留
|
|
865
|
+
* header: { enabled: true }, // 保留
|
|
866
|
+
* };
|
|
867
|
+
*
|
|
868
|
+
* const playgroundConfig = {
|
|
869
|
+
* theme: { colorScheme: 'dark' },
|
|
870
|
+
* threadItemActions: { feedback: true }, // 被过滤
|
|
871
|
+
* };
|
|
872
|
+
*
|
|
873
|
+
* const merged = mergeWithPlaygroundOptions(localConfig, playgroundConfig);
|
|
874
|
+
* // 结果: { api, onClientTool, header, theme }
|
|
875
|
+
* ```
|
|
876
|
+
*/
|
|
877
|
+
export declare function mergeWithPlaygroundOptions<T extends Partial<ChatKitOptions>>(localOptions: T, playgroundOptions: Partial<ChatKitOptions>): T & PlaygroundAllowedOptions;
|
|
878
|
+
|
|
81
879
|
export declare type MessageContentImageUrl = {
|
|
82
880
|
type: "image_url";
|
|
83
881
|
image_url: string | {
|
|
@@ -91,63 +889,300 @@ export declare type MessageContentText = {
|
|
|
91
889
|
text: string;
|
|
92
890
|
};
|
|
93
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 配置白名单 - 只允许这些配置项从 playground 复制过来生效
|
|
907
|
+
* 过滤掉: locale, initialThread, header, history, threadItemActions, disclaimer, entities, widgets, onClientTool
|
|
908
|
+
*/
|
|
909
|
+
/**
|
|
910
|
+
* 允许从 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
|
+
|
|
94
1000
|
/**
|
|
95
1001
|
* Data type for chat event message
|
|
96
1002
|
*/
|
|
97
1003
|
export declare type TChatEventMessage = {
|
|
98
|
-
type?: string
|
|
99
|
-
title?: string
|
|
100
|
-
message?: string
|
|
101
|
-
status?: 'success' | 'fail' | 'running'
|
|
102
|
-
created_date?: Date | string
|
|
103
|
-
end_date?: Date | string
|
|
104
|
-
error?: string
|
|
105
|
-
}
|
|
1004
|
+
type?: string;
|
|
1005
|
+
title?: string;
|
|
1006
|
+
message?: string;
|
|
1007
|
+
status?: 'success' | 'fail' | 'running';
|
|
1008
|
+
created_date?: Date | string;
|
|
1009
|
+
end_date?: Date | string;
|
|
1010
|
+
error?: string;
|
|
1011
|
+
};
|
|
106
1012
|
|
|
107
1013
|
/**
|
|
108
1014
|
* Step message type, in canvas and ai message.
|
|
109
1015
|
*/
|
|
110
|
-
export declare type TChatMessageStep<T = any> = TMessageComponent<TMessageComponentStep<T
|
|
1016
|
+
export declare type TChatMessageStep<T = any> = TMessageComponent<TMessageComponentStep<T>>;
|
|
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';
|
|
111
1131
|
|
|
112
1132
|
/**
|
|
113
1133
|
* Defines the data type of the sub-message of `component` type in the message `content` {@link MessageContentComplex}
|
|
114
1134
|
*/
|
|
115
1135
|
export declare type TMessageComponent<T extends object = object> = T & {
|
|
116
|
-
id?: string
|
|
117
|
-
category: 'Dashboard' | 'Computer' | 'Tool'
|
|
118
|
-
type?: string
|
|
119
|
-
created_date?: Date | string
|
|
120
|
-
}
|
|
1136
|
+
id?: string;
|
|
1137
|
+
category: 'Dashboard' | 'Computer' | 'Tool';
|
|
1138
|
+
type?: string;
|
|
1139
|
+
created_date?: Date | string;
|
|
1140
|
+
};
|
|
121
1141
|
|
|
122
1142
|
export declare type TMessageComponentIframe = {
|
|
123
|
-
type: 'iframe'
|
|
124
|
-
title: string
|
|
125
|
-
url?: string
|
|
1143
|
+
type: 'iframe';
|
|
1144
|
+
title: string;
|
|
1145
|
+
url?: string;
|
|
126
1146
|
data?: {
|
|
127
|
-
url?: string
|
|
128
|
-
}
|
|
129
|
-
}
|
|
1147
|
+
url?: string;
|
|
1148
|
+
};
|
|
1149
|
+
};
|
|
130
1150
|
|
|
131
1151
|
export declare type TMessageComponentStep<T = unknown> = {
|
|
132
|
-
type: ChatMessageStepCategory
|
|
133
|
-
toolset: string
|
|
134
|
-
toolset_id: string
|
|
135
|
-
tool?: string
|
|
136
|
-
title: string
|
|
137
|
-
message: string
|
|
138
|
-
status: 'success' | 'fail' | 'running'
|
|
139
|
-
created_date: Date | string
|
|
140
|
-
end_date: Date | string
|
|
141
|
-
error?: string
|
|
142
|
-
data?: T
|
|
143
|
-
input?: any
|
|
144
|
-
output?: string
|
|
145
|
-
artifact?: any
|
|
146
|
-
}
|
|
1152
|
+
type: ChatMessageStepCategory;
|
|
1153
|
+
toolset: string;
|
|
1154
|
+
toolset_id: string;
|
|
1155
|
+
tool?: string;
|
|
1156
|
+
title: string;
|
|
1157
|
+
message: string;
|
|
1158
|
+
status: 'success' | 'fail' | 'running';
|
|
1159
|
+
created_date: Date | string;
|
|
1160
|
+
end_date: Date | string;
|
|
1161
|
+
error?: string;
|
|
1162
|
+
data?: T;
|
|
1163
|
+
input?: any;
|
|
1164
|
+
output?: string;
|
|
1165
|
+
artifact?: any;
|
|
1166
|
+
};
|
|
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
|
+
};
|
|
147
1182
|
|
|
148
1183
|
/**
|
|
149
1184
|
* Enhance {@link MessageContent} in Langchain.js
|
|
150
|
-
*
|
|
1185
|
+
*
|
|
151
1186
|
* @deprecated use {@link TMessageItems} instead
|
|
152
1187
|
*/
|
|
153
1188
|
export declare type TMessageContent = string | TMessageContentComplex[];
|
|
@@ -160,46 +1195,246 @@ export declare type TMessageContentComplex = (TMessageContentText | TMessageCont
|
|
|
160
1195
|
}) | (Record<string, any> & {
|
|
161
1196
|
type?: never;
|
|
162
1197
|
})) & {
|
|
163
|
-
id?: string
|
|
164
|
-
xpertName?: string
|
|
1198
|
+
id?: string;
|
|
1199
|
+
xpertName?: string;
|
|
165
1200
|
agentKey?: string;
|
|
166
|
-
created_date?: Date | string
|
|
167
|
-
}
|
|
1201
|
+
created_date?: Date | string;
|
|
1202
|
+
};
|
|
168
1203
|
|
|
169
1204
|
/**
|
|
170
1205
|
* Similar to {@link MessageContentText} | {@link MessageContentImageUrl}, which together form {@link MessageContentComplex}
|
|
171
1206
|
*/
|
|
172
1207
|
export declare type TMessageContentComponent<T extends object = object> = {
|
|
173
|
-
id: string
|
|
174
|
-
type: 'component'
|
|
175
|
-
data: TMessageComponent<T
|
|
176
|
-
xpertName?: string
|
|
1208
|
+
id: string;
|
|
1209
|
+
type: 'component';
|
|
1210
|
+
data: TMessageComponent<T>;
|
|
1211
|
+
xpertName?: string;
|
|
177
1212
|
agentKey?: string;
|
|
178
|
-
}
|
|
1213
|
+
};
|
|
179
1214
|
|
|
180
1215
|
export declare type TMessageContentMemory = {
|
|
181
|
-
id?: string
|
|
182
|
-
agentKey?: string
|
|
1216
|
+
id?: string;
|
|
1217
|
+
agentKey?: string;
|
|
183
1218
|
type: "memory";
|
|
184
1219
|
data: any[];
|
|
185
1220
|
};
|
|
186
1221
|
|
|
187
1222
|
export declare type TMessageContentReasoning = {
|
|
188
|
-
id?: string
|
|
189
|
-
xpertName?: string
|
|
190
|
-
agentKey?: string
|
|
1223
|
+
id?: string;
|
|
1224
|
+
xpertName?: string;
|
|
1225
|
+
agentKey?: string;
|
|
191
1226
|
type: "reasoning";
|
|
192
1227
|
text: string;
|
|
193
1228
|
};
|
|
194
1229
|
|
|
195
1230
|
export declare type TMessageContentText = {
|
|
196
|
-
id?: string
|
|
197
|
-
xpertName?: string
|
|
198
|
-
agentKey?: string
|
|
1231
|
+
id?: string;
|
|
1232
|
+
xpertName?: string;
|
|
1233
|
+
agentKey?: string;
|
|
199
1234
|
type: "text";
|
|
200
1235
|
text: string;
|
|
201
1236
|
};
|
|
202
1237
|
|
|
1238
|
+
export declare type TMessageContentWidget = TMessageContentComponent<TMessageComponentWidgetData>;
|
|
1239
|
+
|
|
203
1240
|
export declare type TMessageItems = TMessageContentComplex[];
|
|
204
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
|
+
|
|
205
1440
|
export { }
|