@boldare/askdare 0.1.0 → 0.2.0-rc.1

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.
@@ -0,0 +1,470 @@
1
+
2
+ import { ComponentProps, ComponentType, NamedExoticComponent, ReactElement, ReactNode, Ref } from "react";
3
+ declare const PRESET_NAMES: readonly ["halo", "aura", "sage", "care"];
4
+ type PresetName = (typeof PRESET_NAMES)[number];
5
+ /** Component variants a preset picks; each becomes a `data-ask-*` attribute on the document. */
6
+ interface ThemeVariants {
7
+ readonly avatar: "orb" | "icon" | "initials" | "none";
8
+ readonly welcome: "hero" | "persona" | "intro";
9
+ readonly launcher: "orb" | "circle" | "pill";
10
+ readonly bubbles: "filled" | "plain";
11
+ readonly surface: "solid" | "glass";
12
+ readonly density: "comfortable" | "compact";
13
+ readonly composer: "outline" | "gradient";
14
+ }
15
+ /** What a visitor may attach, as the bot allows it. */
16
+ interface ChatAttachments {
17
+ readonly images: boolean;
18
+ readonly pdf: boolean;
19
+ readonly maxBytes: number;
20
+ readonly maxPerMessage: number;
21
+ readonly maxPdfPages: number;
22
+ }
23
+ /** A bot's public widget settings, in the visitor's language. */
24
+ interface ChatWidget {
25
+ readonly title: string;
26
+ readonly subtitle: string;
27
+ readonly greeting: string;
28
+ readonly placeholder: string;
29
+ /** The language this visitor sees. */
30
+ readonly locale: string;
31
+ readonly starters: readonly string[];
32
+ readonly avatar: string | undefined;
33
+ readonly launcherLabel: string;
34
+ readonly disclosure: false | {
35
+ readonly privacyUrl: string | undefined;
36
+ };
37
+ readonly preset: PresetName;
38
+ readonly variants: ThemeVariants;
39
+ /** `auto` follows the visitor's system setting. */
40
+ readonly colorScheme: "auto" | "light" | "dark";
41
+ /** Every text in the visitor's language, overrides applied; plural keys included. */
42
+ readonly texts: Readonly<Record<string, string>>;
43
+ }
44
+ /** Stylesheets of a chat inside a page, served by the chat route (ADR-0011). */
45
+ interface ChatStyles {
46
+ /** The bot's tokens for both color schemes, then its own `widget.css`. */
47
+ readonly theme: string;
48
+ /** The default look; only `DefaultChat` loads it. */
49
+ readonly skin: string;
50
+ /** `@font-face` rules of the built-in themes; browsers fetch only the fonts in use. */
51
+ readonly fonts: string;
52
+ }
53
+ /** What the browser needs to run one bot's chat. Public: it never holds secrets (ADR-0008). */
54
+ interface ChatConfig {
55
+ readonly protocolVersion: number;
56
+ /** Path of the chat route, such as `/api/chat`. Same origin only (ADR-0011). */
57
+ readonly basePath: string;
58
+ readonly botId: string;
59
+ readonly widget: ChatWidget;
60
+ /** Whether the bot accepts a description of the page it is on. */
61
+ readonly pageContext: boolean;
62
+ /** Whether the bot lets visitors rate answers. Answers carry a handle when the route takes ratings. */
63
+ readonly feedback: boolean;
64
+ /** Absent when attachments are off. */
65
+ readonly attachments?: ChatAttachments;
66
+ /** Absent when voice input is off. The model stays on the server. */
67
+ readonly voice?: {
68
+ readonly maxSeconds: number;
69
+ };
70
+ /** From `getChatConfig`, for a chat inside a page. The iframe links its own stylesheets. */
71
+ readonly styles?: ChatStyles;
72
+ }
73
+ /** Parts of the default look you can replace. They take no props: read the chat with the hooks. */
74
+ interface DefaultChatComponents {
75
+ readonly Header?: ComponentType;
76
+ readonly Welcome?: ComponentType;
77
+ /** Rendered for each message; `useMessage()` gives the message. */
78
+ readonly Message?: ComponentType;
79
+ /** The message field and the AI notice under it. */
80
+ readonly Footer?: ComponentType;
81
+ }
82
+ interface DefaultPanelProps {
83
+ /** Level of the chat's title (default 2); 1 makes the chat the page's main landmark. */
84
+ readonly headingLevel?: 1 | 2 | 3 | 4 | 5;
85
+ /** Shows a close button, and Escape calls it too. */
86
+ readonly onClose?: (() => void) | undefined;
87
+ readonly components?: DefaultChatComponents | undefined;
88
+ }
89
+ interface ThemeProps extends ComponentProps<"div"> {
90
+ /** Overrides the bot's color scheme, for example to follow your site's dark mode switch. */
91
+ readonly colorScheme?: "auto" | "light" | "dark" | undefined;
92
+ }
93
+ /**
94
+ * The theme root of a chat inside a page: sets the bot's tokens (`--ask-*`) and variant attributes
95
+ * for everything inside it, and loads the bot's theme and fonts from the chat route. Size it with
96
+ * `className` or `style`; the chat fills it.
97
+ */
98
+ export declare function Theme({ colorScheme, children, ...props }: ThemeProps): ReactElement;
99
+ interface DefaultChatProps extends DefaultPanelProps {
100
+ /** On the element that holds the chat. Give it a height: the chat fills it. */
101
+ readonly className?: string | undefined;
102
+ readonly colorScheme?: ThemeProps["colorScheme"];
103
+ }
104
+ /**
105
+ * The widget's look inside your page: `<Root config={config}><DefaultChat className="…" /></Root>`.
106
+ * It loads its stylesheets from the chat route, so there is nothing to import or configure.
107
+ */
108
+ export declare function DefaultChat({ className, colorScheme, ...panel }: DefaultChatProps): ReactElement;
109
+ /**
110
+ * Every text the widget shows. The keys are public API (ADR-0008): override any of them with
111
+ * `widget.texts`. Plural keys end in a CLDR category (`zero`, `one`, `two`, `few`, `many`, `other`).
112
+ */
113
+ declare const EN: {
114
+ readonly "header.title": "Assistant";
115
+ readonly "header.newConversation": "Start a new conversation";
116
+ readonly "header.close": "Close chat";
117
+ readonly "confirm.newConversation": "Start a new conversation? The current one will be deleted.";
118
+ readonly "confirm.cancel": "Cancel";
119
+ readonly "confirm.accept": "Start new";
120
+ readonly "welcome.label": "Welcome";
121
+ readonly "welcome.greeting": "Hi! How can I help?";
122
+ readonly "welcome.online": "Online";
123
+ readonly "welcome.suggestions": "Suggested questions";
124
+ readonly "composer.placeholder": "Type your message…";
125
+ readonly "composer.send": "Send";
126
+ readonly "composer.attach": "Attach files";
127
+ readonly "composer.dictate": "Dictate a message";
128
+ readonly "status.loading": "Loading the conversation…";
129
+ readonly "status.thinking": "Thinking…";
130
+ readonly "status.searching": "Searching documents…";
131
+ readonly "status.tool": "Using {name}…";
132
+ readonly "status.typing": "The assistant is typing";
133
+ readonly "message.sources": "Sources";
134
+ readonly "feedback.label": "Rate this answer";
135
+ readonly "feedback.up": "Helpful";
136
+ readonly "feedback.down": "Not helpful";
137
+ readonly "feedback.comment": "What went wrong?";
138
+ readonly "feedback.send": "Send feedback";
139
+ readonly "feedback.skip": "Skip";
140
+ readonly "message.attachments.one": "{count} attachment";
141
+ readonly "message.attachments.other": "{count} attachments";
142
+ readonly "attachment.list": "Attachments";
143
+ readonly "attachment.uploading": "Uploading…";
144
+ readonly "attachment.remove": "Remove {name}";
145
+ readonly "attachment.unsupported": "This file type is not supported.";
146
+ readonly "attachment.tooLarge": "Too large (max {size}).";
147
+ readonly "attachment.tooMany": "You can attach up to {count} files per message.";
148
+ readonly "dictation.listening": "Listening…";
149
+ readonly "dictation.transcribing": "Transcribing…";
150
+ readonly "dictation.cancel": "Cancel dictation";
151
+ readonly "dictation.done": "Done";
152
+ readonly "dictation.empty": "Nothing was recorded. Please try again.";
153
+ readonly "microphone.blocked": "Microphone access is blocked. Allow it in your browser to dictate.";
154
+ readonly "microphone.missing": "No microphone was found.";
155
+ readonly "microphone.failed": "The microphone could not be started.";
156
+ readonly "disclosure.text": "You’re chatting with an AI assistant. It can make mistakes.";
157
+ readonly "disclosure.privacy": "Privacy policy";
158
+ readonly "launcher.label": "Ask us";
159
+ readonly "launcher.open": "Open chat";
160
+ readonly "launcher.close": "Close chat";
161
+ readonly "launcher.unavailable": "The chat couldn’t load. Please try again later.";
162
+ readonly "error.connection": "Connection problem. Please try again.";
163
+ readonly "error.history": "Could not load the previous conversation.";
164
+ readonly "error.updated": "The assistant was updated. Please reload the page.";
165
+ readonly "error.stalled": "The connection stalled. Please try again.";
166
+ readonly "error.uploadFailed": "The file could not be uploaded.";
167
+ readonly "error.transcriptionFailed": "The recording could not be transcribed.";
168
+ readonly "error.invalid_input": "The request was invalid.";
169
+ readonly "error.unauthorized": "Authentication is required.";
170
+ readonly "error.session_expired": "Your session has expired. Please try again.";
171
+ readonly "error.not_found": "Not found.";
172
+ readonly "error.content_blocked": "This message cannot be processed.";
173
+ readonly "error.rate_limited": "Too many messages. Please wait a moment.";
174
+ readonly "error.budget_exceeded": "The assistant is unavailable for the rest of the day.";
175
+ readonly "error.internal_error": "Something went wrong. Please try again.";
176
+ readonly "error.upstream_error": "The assistant is temporarily unavailable. Please try again.";
177
+ readonly "error.bot_unavailable": "The assistant is currently unavailable.";
178
+ readonly "error.timeout": "The assistant took too long to respond. Please try again.";
179
+ readonly "error.conversationTooLong": "This conversation is too long. Please start a new one.";
180
+ readonly "error.conversationGone": "This conversation is no longer available.";
181
+ readonly "error.messageLength": "Messages can be up to {max} characters.";
182
+ readonly "error.attachmentExpired": "An attachment expired or is invalid. Please attach it again.";
183
+ readonly "error.filesNotAccepted": "This assistant does not accept files.";
184
+ readonly "error.tooManyFiles": "Attach up to {count} files per message.";
185
+ readonly "error.fileType.images": "Only images (PNG, JPEG, WebP, GIF) are supported.";
186
+ readonly "error.fileType.pdf": "Only PDF files are supported.";
187
+ readonly "error.fileType.both": "Only images (PNG, JPEG, WebP, GIF) and PDF files are supported.";
188
+ readonly "error.fileTooLarge": "Files can be up to {size}.";
189
+ readonly "error.pdfPages": "PDFs can have up to {max} pages.";
190
+ readonly "error.voiceNotAccepted": "This assistant does not accept voice input.";
191
+ readonly "error.recordingFormat": "This recording format is not supported.";
192
+ readonly "error.recordingTooLong": "This recording is too long.";
193
+ readonly "error.dictationBusy": "Another dictation is still being transcribed. Please try again in a moment.";
194
+ readonly "error.dictationBudget": "Dictation is unavailable for the rest of the day. You can still type.";
195
+ };
196
+ /** Plural texts: the base plus a CLDR category, every category overridable. */
197
+ declare const PLURAL_BASES: readonly ["message.attachments"];
198
+ declare const PLURAL_FORMS: readonly ["zero", "one", "two", "few", "many", "other"];
199
+ type TextKey = keyof typeof EN | `${(typeof PLURAL_BASES)[number]}.${(typeof PLURAL_FORMS)[number]}`;
200
+ /** What the client needs to rate one answer (ADR-0012). */
201
+ interface FeedbackHandle {
202
+ /** Opaque; sent back to `POST /feedback`. */
203
+ readonly handle: string;
204
+ /** Stable for the answer across reloads, so the client can remember its rating. Hex. */
205
+ readonly key: string;
206
+ }
207
+ /** What a page may set with askdare('configure') or the props of `Root`, checked again here. */
208
+ interface PageOptions {
209
+ readonly greeting?: string;
210
+ readonly starters?: readonly string[];
211
+ readonly context?: string;
212
+ }
213
+ interface Citation {
214
+ readonly index: number;
215
+ readonly title: string;
216
+ readonly url?: string | undefined;
217
+ }
218
+ interface SentFile {
219
+ readonly name: string;
220
+ readonly kind: "image" | "pdf";
221
+ /** Local preview of an image sent in this session; history only knows how many files there were. */
222
+ readonly previewUrl?: string | undefined;
223
+ }
224
+ interface ChatMessage {
225
+ readonly id: string;
226
+ readonly role: "user" | "assistant";
227
+ readonly text: string;
228
+ readonly citations: readonly Citation[];
229
+ /** Number of files, from history. */
230
+ readonly attachments: number;
231
+ /** Files sent in this session. */
232
+ readonly files?: readonly SentFile[];
233
+ readonly status: "streaming" | "done" | "error";
234
+ /** On answers the visitor may rate: `key` is where `ChatState.ratings` keeps their rating. */
235
+ readonly feedback?: FeedbackHandle | undefined;
236
+ }
237
+ type Rating = "up" | "down";
238
+ /** A file picked for the next message. */
239
+ interface PendingFile {
240
+ readonly key: string;
241
+ readonly name: string;
242
+ readonly kind?: "image" | "pdf" | undefined;
243
+ readonly previewUrl?: string | undefined;
244
+ readonly status: "uploading" | "ready" | "error";
245
+ readonly handle?: string | undefined;
246
+ readonly error?: string | undefined;
247
+ }
248
+ /**
249
+ * `starting` until the chat knows who the visitor is (and on the server), `loading` while a stored
250
+ * conversation loads, then `ready`.
251
+ */
252
+ type ChatPhase = "starting" | "loading" | "ready";
253
+ type Dictation = "idle" | "recording" | "transcribing";
254
+ interface ChatState {
255
+ readonly phase: ChatPhase;
256
+ /** A turn, or deleting the conversation, is under way. */
257
+ readonly busy: boolean;
258
+ readonly messages: readonly ChatMessage[];
259
+ readonly draft: string;
260
+ readonly error: string | undefined;
261
+ /** What the assistant is doing while no text streams, such as searching documents. */
262
+ readonly activity: string | null;
263
+ readonly files: readonly PendingFile[];
264
+ readonly dictation: Dictation;
265
+ /** Seconds of the current dictation. */
266
+ readonly elapsed: number;
267
+ /** Whether this browser can record (and the bot has voice input). False on the server. */
268
+ readonly canDictate: boolean;
269
+ /** Greeting, starters and context set by the page. */
270
+ readonly page: PageOptions;
271
+ /** The visitor's own ratings of answers, by `ChatMessage.feedback.key`; kept in this browser. */
272
+ readonly ratings: Readonly<Record<string, Rating>>;
273
+ /** The id of the answer just rated 👎, while the chat asks what went wrong. */
274
+ readonly commenting: string | undefined;
275
+ }
276
+ /** A text in the visitor's language, with `{name}` placeholders filled. */
277
+ type Translate = (key: TextKey, params?: Readonly<Record<string, string | number>>) => string;
278
+ /** What visitors can do in the chat; the same for every UI on top of the store. */
279
+ interface ChatActions {
280
+ /** Sends the draft with the files that are ready, or `text` (a starter) on its own. */
281
+ send(text?: string): Promise<void>;
282
+ setDraft(text: string): void;
283
+ /** Uploads files for the next message, as many as the bot allows. */
284
+ addFiles(files: readonly File[]): void;
285
+ removeFile(key: string): void;
286
+ startDictation(): Promise<void>;
287
+ /** Stops the dictation and puts the transcript into the draft. */
288
+ finishDictation(): Promise<void>;
289
+ cancelDictation(): void;
290
+ /** Deletes the conversation and starts with an empty chat. */
291
+ newConversation(): Promise<void>;
292
+ /**
293
+ * Rates an answer by its message id: 👍, 👎, or null to take the rating back. After 👎 the chat
294
+ * asks what went wrong (`state.commenting`); pass the answer as `comment` with the same rating.
295
+ */
296
+ rate(messageId: string, rating: Rating | null, comment?: string): Promise<void>;
297
+ /** Closes the question after 👎 without a comment. */
298
+ dismissComment(): void;
299
+ /** Moves keyboard focus to the message field, wherever focus is now. */
300
+ focus(): void;
301
+ }
302
+ type ComposerProps = ComponentProps<"form">;
303
+ /** The form around the message field; submitting it sends the draft. */
304
+ export declare function Composer({ onSubmit, ...props }: ComposerProps): ReactElement;
305
+ type InputProps = Omit<ComponentProps<"textarea">, "value">;
306
+ /**
307
+ * The message field. Enter sends, Shift+Enter starts a new line, pasted files are attached, and
308
+ * it grows with its text. It takes focus when the chat moves it here.
309
+ */
310
+ export declare function Input({ ref, onKeyDown, onPaste, onChange, ...props }: InputProps): ReactElement;
311
+ type SendProps = ComponentProps<"button">;
312
+ /** Sends the draft; disabled until there is something to send. */
313
+ export declare function Send(props: SendProps): ReactElement;
314
+ type AttachButtonProps = ComponentProps<"button">;
315
+ /**
316
+ * Opens the file picker, next to its hidden file input. Renders nothing when the bot takes no
317
+ * attachments.
318
+ */
319
+ export declare function AttachButton({ onClick, ...props }: AttachButtonProps): ReactElement | null;
320
+ type FilesProps = ComponentProps<"ul">;
321
+ /** The files picked for the next message, each with a remove button. */
322
+ export declare function Files(props: FilesProps): ReactElement | null;
323
+ type DictateButtonProps = ComponentProps<"button">;
324
+ /** Starts a dictation. Renders nothing without voice input or a usable microphone. */
325
+ export declare function DictateButton({ onClick, ...props }: DictateButtonProps): ReactElement | null;
326
+ interface RecorderProps extends ComponentProps<"div"> {
327
+ /** Inside the cancel button, which is labelled for screen readers. Default `×`. */
328
+ readonly cancelIcon?: ReactNode;
329
+ }
330
+ /**
331
+ * The dictation in place of the message field: a level meter, the time, cancel and done. Renders
332
+ * nothing while no dictation runs.
333
+ */
334
+ export declare function Recorder({ cancelIcon, ...props }: RecorderProps): ReactElement | null;
335
+ /** The bot as the visitor sees it: its settings, with the page's greeting and starters applied. */
336
+ interface ChatBot {
337
+ readonly id: string;
338
+ readonly title: string;
339
+ readonly subtitle: string;
340
+ readonly greeting: string;
341
+ readonly starters: readonly string[];
342
+ readonly placeholder: string;
343
+ /** The picture configured for the assistant, if any. */
344
+ readonly avatar: string | undefined;
345
+ /** The language the visitor sees. */
346
+ readonly locale: string;
347
+ /** The AI notice under the message field, with an optional privacy policy link; false when off. */
348
+ readonly disclosure: false | {
349
+ readonly privacyUrl: string | undefined;
350
+ };
351
+ readonly preset: PresetName;
352
+ readonly variants: ThemeVariants;
353
+ /** What visitors may attach; undefined when attachments are off. */
354
+ readonly attachments: ChatAttachments | undefined;
355
+ /** Longest dictation in seconds; undefined when voice input is off. */
356
+ readonly maxDictationSeconds: number | undefined;
357
+ /** Every text in the visitor's language, plural forms included. */
358
+ readonly texts: Readonly<Record<string, string>>;
359
+ }
360
+ interface Chat {
361
+ readonly state: ChatState;
362
+ readonly actions: ChatActions;
363
+ readonly bot: ChatBot;
364
+ /** A text in the visitor's language by its key, such as `composer.send`. */
365
+ readonly t: Translate;
366
+ }
367
+ /** The whole chat: its state, actions, bot settings and texts. Re-renders on every change. */
368
+ export declare function useChat(): Chat;
369
+ /**
370
+ * One value from the chat's state, such as `useChatState((state) => state.busy)`. Re-renders only
371
+ * when that value changes, so return a primitive or a part of the state, not a new object.
372
+ */
373
+ export declare function useChatState<T>(select: (state: ChatState) => T): T;
374
+ /** The message being rendered, inside `MessageList`. */
375
+ export declare function useMessage(): ChatMessage;
376
+ interface FeedbackButtonProps extends ComponentProps<"button"> {
377
+ /** What a click rates the answer: 👍 `up` or 👎 `down`. A second click takes the rating back. */
378
+ readonly rating: Rating;
379
+ }
380
+ /**
381
+ * Rates the answer it is in (ADR-0012), pressed while that is the visitor's rating. Renders
382
+ * nothing for the visitor's own messages, an answer still streaming, or a bot whose answers can't
383
+ * be rated. After 👎 the chat's `state.commenting` names the answer to ask about.
384
+ */
385
+ export declare function FeedbackButton({ rating, onClick, ...props }: FeedbackButtonProps): ReactElement | null;
386
+ /**
387
+ * Renders model output as markdown (GFM) without ever producing raw HTML: marked only tokenizes,
388
+ * and each token becomes an element here. HTML in the source is dropped, links are limited to
389
+ * http(s)/mailto and open in a new tab, and images are never loaded (ADR-0004).
390
+ */
391
+ interface MarkdownProps {
392
+ /** Model output, as streamed. */
393
+ readonly text: string;
394
+ }
395
+ export declare const Markdown: NamedExoticComponent<MarkdownProps>;
396
+ type MessagesProps = ComponentProps<"div">;
397
+ /**
398
+ * The conversation: a live region that follows the latest message as it streams. Holds the
399
+ * welcome, the `MessageList` and the `Status`.
400
+ */
401
+ export declare function Messages({ ref, ...props }: MessagesProps): ReactElement;
402
+ interface MessageListProps {
403
+ /** Rendered once per message; read the message with `useMessage()`. */
404
+ readonly children?: ReactNode;
405
+ }
406
+ /** Renders its children for every message worth showing. Has no element of its own. */
407
+ export declare function MessageList({ children }: MessageListProps): ReactElement;
408
+ type MessageProps = ComponentProps<"div">;
409
+ /**
410
+ * One message, with `data-role` and `data-status`. The message primitives read only their own
411
+ * message, so a streaming answer doesn't re-render the earlier ones.
412
+ */
413
+ export declare function Message(props: MessageProps): ReactElement;
414
+ type MessageTextProps = ComponentProps<"div">;
415
+ /**
416
+ * The message's bubble: the visitor's text as typed, an answer as Markdown, and typing dots while
417
+ * an answer has no text yet.
418
+ */
419
+ export declare function MessageText(props: MessageTextProps): ReactElement | null;
420
+ type CitationsProps = ComponentProps<"ol">;
421
+ /** The sources of an answer. Links go through the same check as links in answers. */
422
+ export declare function Citations(props: CitationsProps): ReactElement | null;
423
+ type MessageFilesProps = Omit<ComponentProps<"ul">, "ref"> & {
424
+ readonly ref?: Ref<HTMLElement>;
425
+ };
426
+ /**
427
+ * The files sent with a message: previews from this visit, or after a reload only how many there
428
+ * were (`attachments-note`).
429
+ */
430
+ export declare function MessageFiles({ ref, ...props }: MessageFilesProps): ReactElement | null;
431
+ type StatusProps = ComponentProps<"p">;
432
+ /** What the chat is doing: loading a conversation, or what the assistant does before it writes. */
433
+ export declare function Status(props: StatusProps): ReactElement | null;
434
+ type ErrorMessageProps = ComponentProps<"p">;
435
+ /** The latest problem, in the visitor's language, announced to screen readers. */
436
+ export declare function ErrorMessage(props: ErrorMessageProps): ReactElement | null;
437
+ interface PanelProps extends ComponentProps<"section"> {
438
+ /**
439
+ * `main` when the chat is the page, as in its iframe; otherwise a region named after the bot,
440
+ * so it sits among the page's own landmarks. Default `region`.
441
+ */
442
+ readonly landmark?: "main" | "region";
443
+ }
444
+ /**
445
+ * The chat's frame, with `data-busy` while the assistant answers or a dictation runs. Files dropped
446
+ * on it are attached (`data-dragging` while they are over it).
447
+ */
448
+ export declare function Panel({ landmark, onDragOver, onDragLeave, onDrop, ...props }: PanelProps): ReactElement;
449
+ interface RootProps {
450
+ /** From `getChatConfig()` in a Server Component. */
451
+ readonly config: ChatConfig;
452
+ /**
453
+ * The signed-in visitor: a token from your backend, as for `askdare('identify')`, or null when
454
+ * signed out (ADR-0009). A page that passes one must not be cached.
455
+ */
456
+ readonly identity?: string | null | undefined;
457
+ /** A short description of the page for the assistant, up to 1,000 characters (`pageContext`). */
458
+ readonly context?: string | undefined;
459
+ /** This page's greeting, instead of the bot's. */
460
+ readonly greeting?: string | undefined;
461
+ /** This page's suggested questions, up to 4. */
462
+ readonly starters?: readonly string[] | undefined;
463
+ readonly children?: ReactNode;
464
+ }
465
+ /**
466
+ * Runs one bot's chat for the components inside it, without rendering any element. Its props
467
+ * take what `askdare('identify')` and `askdare('configure')` take, checked the same way.
468
+ */
469
+ export declare function Root({ config, identity, context, greeting, starters, children }: RootProps): ReactElement;
470
+ export type { AttachButtonProps, Chat, ChatActions, ChatAttachments, ChatBot, ChatConfig, ChatMessage, ChatPhase, ChatState, ChatStyles, ChatWidget, Citation, CitationsProps, ComposerProps, DefaultChatComponents, DefaultChatProps, DictateButtonProps, Dictation, ErrorMessageProps, FeedbackButtonProps, FilesProps, InputProps, MarkdownProps, MessageFilesProps, MessageListProps, MessageProps, MessageTextProps, MessagesProps, PanelProps, PendingFile, Rating, RecorderProps, RootProps, SendProps, SentFile, StatusProps, ThemeProps, Translate };