@slipstream-ui/ai 0.0.0-stage → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/LICENSE +25 -0
  2. package/dist/index.d.mts +579 -0
  3. package/dist/index.d.ts +579 -0
  4. package/dist/index.js +1778 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.mjs +1706 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/dist/manifests/attachment.manifest.json +33 -0
  9. package/dist/manifests/branch.manifest.json +65 -0
  10. package/dist/manifests/chain-thought.manifest.json +39 -0
  11. package/dist/manifests/code-block.manifest.json +50 -0
  12. package/dist/manifests/command-palette.manifest.json +80 -0
  13. package/dist/manifests/confirmation.manifest.json +143 -0
  14. package/dist/manifests/conversation.manifest.json +290 -0
  15. package/dist/manifests/inline-citation.manifest.json +46 -0
  16. package/dist/manifests/message-actions.manifest.json +35 -0
  17. package/dist/manifests/message.manifest.json +235 -0
  18. package/dist/manifests/prompt-input.manifest.json +334 -0
  19. package/dist/manifests/reasoning.manifest.json +177 -0
  20. package/dist/manifests/response.manifest.json +51 -0
  21. package/dist/manifests/source.manifest.json +78 -0
  22. package/dist/manifests/streaming-indicator.manifest.json +39 -0
  23. package/dist/manifests/suggestions.manifest.json +45 -0
  24. package/dist/manifests/tool-call.manifest.json +158 -0
  25. package/package.json +61 -3
  26. package/src/adapter/adapter.test.tsx +83 -0
  27. package/src/adapter/hooks.ts +82 -0
  28. package/src/adapter/index.ts +3 -0
  29. package/src/adapter/messages.ts +49 -0
  30. package/src/adapter/types.ts +24 -0
  31. package/src/components/attachment/Attachment.test.tsx +72 -0
  32. package/src/components/attachment/Attachment.tsx +84 -0
  33. package/src/components/attachment/AttachmentList.tsx +30 -0
  34. package/src/components/attachment/index.ts +5 -0
  35. package/src/components/branch/Branch.test.tsx +52 -0
  36. package/src/components/branch/Branch.tsx +77 -0
  37. package/src/components/branch/index.ts +2 -0
  38. package/src/components/chainthought/ChainThought.test.tsx +34 -0
  39. package/src/components/chainthought/ChainThought.tsx +45 -0
  40. package/src/components/chainthought/index.ts +2 -0
  41. package/src/components/code-block/CodeBlock.test.tsx +46 -0
  42. package/src/components/code-block/CodeBlock.tsx +95 -0
  43. package/src/components/code-block/index.ts +2 -0
  44. package/src/components/command-palette/CommandPalette.test.tsx +74 -0
  45. package/src/components/command-palette/CommandPalette.tsx +156 -0
  46. package/src/components/command-palette/index.ts +2 -0
  47. package/src/components/confirmation/Confirmation.test.tsx +97 -0
  48. package/src/components/confirmation/Confirmation.tsx +146 -0
  49. package/src/components/confirmation/index.ts +2 -0
  50. package/src/components/conversation/Conversation.test.tsx +49 -0
  51. package/src/components/conversation/Conversation.tsx +301 -0
  52. package/src/components/conversation/Conversation.welcome.test.tsx +73 -0
  53. package/src/components/conversation/index.ts +2 -0
  54. package/src/components/inline-citation/InlineCitation.test.tsx +42 -0
  55. package/src/components/inline-citation/InlineCitation.tsx +56 -0
  56. package/src/components/inline-citation/index.ts +2 -0
  57. package/src/components/message/Message.error-edit.test.tsx +60 -0
  58. package/src/components/message/Message.test.tsx +80 -0
  59. package/src/components/message/Message.tsx +205 -0
  60. package/src/components/message/index.ts +2 -0
  61. package/src/components/message-actions/MessageActions.test.tsx +77 -0
  62. package/src/components/message-actions/MessageActions.tsx +134 -0
  63. package/src/components/message-actions/index.ts +2 -0
  64. package/src/components/prompt-input/PromptInput.compound.test.tsx +150 -0
  65. package/src/components/prompt-input/PromptInput.test.tsx +74 -0
  66. package/src/components/prompt-input/PromptInput.tsx +584 -0
  67. package/src/components/prompt-input/index.ts +21 -0
  68. package/src/components/reasoning/Reasoning.duration.test.tsx +35 -0
  69. package/src/components/reasoning/Reasoning.test.tsx +58 -0
  70. package/src/components/reasoning/Reasoning.tsx +85 -0
  71. package/src/components/reasoning/index.ts +2 -0
  72. package/src/components/response/Response.test.tsx +69 -0
  73. package/src/components/response/Response.tsx +75 -0
  74. package/src/components/response/close-incomplete-markdown.ts +47 -0
  75. package/src/components/response/index.ts +3 -0
  76. package/src/components/source/Source.tsx +51 -0
  77. package/src/components/source/Sources.tsx +42 -0
  78. package/src/components/source/index.ts +5 -0
  79. package/src/components/source/source.test.tsx +72 -0
  80. package/src/components/streaming/StreamingIndicator.test.tsx +26 -0
  81. package/src/components/streaming/StreamingIndicator.tsx +46 -0
  82. package/src/components/streaming/index.ts +2 -0
  83. package/src/components/suggestion/Suggestion.test.tsx +43 -0
  84. package/src/components/suggestion/Suggestion.tsx +47 -0
  85. package/src/components/suggestion/index.ts +2 -0
  86. package/src/components/tool-call/ToolCall.test.tsx +45 -0
  87. package/src/components/tool-call/ToolCall.tsx +101 -0
  88. package/src/components/tool-call/index.ts +2 -0
  89. package/src/index.ts +29 -0
  90. package/src/manifests/attachment.manifest.json +33 -0
  91. package/src/manifests/branch.manifest.json +65 -0
  92. package/src/manifests/chain-thought.manifest.json +39 -0
  93. package/src/manifests/code-block.manifest.json +50 -0
  94. package/src/manifests/command-palette.manifest.json +80 -0
  95. package/src/manifests/confirmation.manifest.json +143 -0
  96. package/src/manifests/conversation.manifest.json +290 -0
  97. package/src/manifests/inline-citation.manifest.json +46 -0
  98. package/src/manifests/message-actions.manifest.json +35 -0
  99. package/src/manifests/message.manifest.json +235 -0
  100. package/src/manifests/prompt-input.manifest.json +334 -0
  101. package/src/manifests/reasoning.manifest.json +177 -0
  102. package/src/manifests/response.manifest.json +51 -0
  103. package/src/manifests/source.manifest.json +78 -0
  104. package/src/manifests/streaming-indicator.manifest.json +39 -0
  105. package/src/manifests/suggestions.manifest.json +45 -0
  106. package/src/manifests/tool-call.manifest.json +158 -0
  107. package/src/test/jest-axe.d.ts +16 -0
  108. package/src/test/setup.ts +18 -0
  109. package/src/test/vitest-matchers.d.ts +10 -0
  110. package/src/types/index.ts +40 -0
  111. package/README.md +0 -3
package/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Michael McShinsky
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ <<<<<<< HEAD
22
+ SOFTWARE.
23
+ =======
24
+ SOFTWARE.
25
+ >>>>>>> origin/main
@@ -0,0 +1,579 @@
1
+ import * as React from 'react';
2
+
3
+ /**
4
+ * AI Component Types
5
+ *
6
+ * Shared types for AI interaction components like Message, Conversation, etc.
7
+ */
8
+ type MessageRole = 'user' | 'assistant' | 'system' | 'tool';
9
+ type Message = {
10
+ id: string;
11
+ role: MessageRole;
12
+ content: string;
13
+ timestamp?: Date;
14
+ metadata?: Record<string, unknown>;
15
+ };
16
+ type ToolCall$1 = {
17
+ id: string;
18
+ name: string;
19
+ arguments: Record<string, unknown>;
20
+ result?: string | number | boolean | Record<string, unknown> | unknown[];
21
+ status: 'pending' | 'running' | 'completed' | 'failed';
22
+ /** Error detail rendered when status is failed. */
23
+ error?: string;
24
+ };
25
+ type ReasoningStep = {
26
+ id: string;
27
+ content: string;
28
+ timestamp?: Date;
29
+ };
30
+ /** A single citation or reference attached to an AI response. */
31
+ type SourceItem = {
32
+ id: string;
33
+ title: string;
34
+ url?: string;
35
+ snippet?: string;
36
+ };
37
+
38
+ type MessageProps = {
39
+ message: Message;
40
+ className?: string;
41
+ showAvatar?: boolean;
42
+ avatarSrc?: string;
43
+ avatarFallback?: string;
44
+ /** Display name for the user role; override for localization. */
45
+ userLabel?: string;
46
+ /** Display name for the assistant role; override for localization. */
47
+ assistantLabel?: string;
48
+ /**
49
+ * Custom content renderer, e.g. for markdown/code blocks.
50
+ * When provided, it fully replaces the default plain-text rendering.
51
+ */
52
+ renderContent?: (content: string) => React.ReactNode;
53
+ /**
54
+ * Marks the response as still being generated: shows a typing cursor
55
+ * and sets aria-busy so assistive tech knows more content is coming.
56
+ */
57
+ isStreaming?: boolean;
58
+ /** Generation failure text; renders an error card in place of content. */
59
+ error?: string;
60
+ /** Called when the user requests a retry after `error`; omit to hide the action. */
61
+ onRetry?: () => void;
62
+ labels?: {
63
+ retry?: string;
64
+ edit?: string;
65
+ save?: string;
66
+ cancel?: string;
67
+ };
68
+ /**
69
+ * Edit-and-resubmit affordance for user messages: renders an Edit action
70
+ * that swaps content into an inline textarea and calls `onEditContent`.
71
+ */
72
+ onEditContent?: (content: string) => void;
73
+ };
74
+ /**
75
+ * Memoized: during token streaming the parent re-renders on every tick, but
76
+ * only the streaming message's object identity changes. Memo skips re-render
77
+ * (and timestamp re-formatting) for every other message in the transcript.
78
+ * Callback props must be referentially stable for memo to help.
79
+ */
80
+ declare const MemoizedMessage: React.MemoExoticComponent<React.ForwardRefExoticComponent<MessageProps & React.RefAttributes<HTMLDivElement>>>;
81
+
82
+ /** User sentiment for an AI response. */
83
+ type FeedbackRating = 'up' | 'down';
84
+ type MessageActionsProps = {
85
+ /**
86
+ * Visibility rule:
87
+ * - 'always': always visible (default)
88
+ * - 'on-hover': fades in when the parent message is hovered/focused
89
+ * (add the `group` class to the parent element)
90
+ * - 'not-last': like 'on-hover', intended for non-latest messages
91
+ */
92
+ autohide?: 'always' | 'on-hover' | 'not-last';
93
+ /**
94
+ * Content to copy. Omit to hide the copy action, or pass a getter when
95
+ * the content lives outside this component.
96
+ */
97
+ content?: string;
98
+ /** Called after the user copies the message; receives the copied text. */
99
+ onCopy?: (content: string) => void;
100
+ /** Called with the selected rating; selecting the same rating clears it (passes undefined). */
101
+ onFeedback?: (rating: FeedbackRating | undefined) => void;
102
+ /** Called when the user requests a regenerated response; omit to hide the action. */
103
+ onRegenerate?: () => void;
104
+ labels?: {
105
+ copy?: string;
106
+ copied?: string;
107
+ thumbUp?: string;
108
+ thumbDown?: string;
109
+ regenerate?: string;
110
+ };
111
+ className?: string;
112
+ };
113
+ declare const MessageActions: React.ForwardRefExoticComponent<MessageActionsProps & React.RefAttributes<HTMLDivElement>>;
114
+
115
+ /** A single file attached to a message or prompt. Display-only; upload logic stays consumer-side. */
116
+ type AttachmentItem = {
117
+ id: string;
118
+ /** File name, including extension. */
119
+ name: string;
120
+ /** Human-readable size, e.g. "2.4 MB". */
121
+ size?: string;
122
+ /** MIME type or simple kind used for the chip label. */
123
+ type?: string;
124
+ /** Optional image thumbnail URL. */
125
+ previewUrl?: string;
126
+ status?: 'uploading' | 'done' | 'error';
127
+ };
128
+ type AttachmentProps = {
129
+ attachment: AttachmentItem;
130
+ /** Called when the user removes the attachment; omit to hide the remove control. */
131
+ onRemove?: (attachment: AttachmentItem) => void;
132
+ className?: string;
133
+ };
134
+ declare const Attachment: React.ForwardRefExoticComponent<AttachmentProps & React.RefAttributes<HTMLDivElement>>;
135
+
136
+ type AttachmentListProps = {
137
+ attachments: AttachmentItem[];
138
+ /** Passed through to every Attachment; omit to hide remove controls. */
139
+ onRemove?: (attachment: AttachmentItem) => void;
140
+ className?: string;
141
+ };
142
+ declare const AttachmentList: React.ForwardRefExoticComponent<AttachmentListProps & React.RefAttributes<HTMLDivElement>>;
143
+
144
+ type ResponseProps = {
145
+ /** Markdown content to render. */
146
+ children: string;
147
+ /**
148
+ * Repair unclosed emphasis/inline-code/fences while streaming so partial
149
+ * chunks render cleanly (default true).
150
+ */
151
+ parseIncompleteMarkdown?: boolean;
152
+ className?: string;
153
+ };
154
+ /**
155
+ * Streaming-optimized markdown renderer for AI responses.
156
+ *
157
+ * Wraps react-markdown with GFM support and routes fenced code blocks to
158
+ * the CodeBlock component for highlighting + copy.
159
+ */
160
+ declare const Response: React.ForwardRefExoticComponent<ResponseProps & React.RefAttributes<HTMLDivElement>>;
161
+
162
+ /**
163
+ * Repairs markdown that is mid-stream: closes unclosed bold/italic/strikethrough
164
+ * markers and unterminated inline code / code fences so partial chunks render
165
+ * without flickering or broken syntax.
166
+ *
167
+ * Deliberately conservative — only appends closing characters, never rewrites content.
168
+ */
169
+ declare function closeIncompleteMarkdown(markdown: string): string;
170
+
171
+ type CodeBlockProps = {
172
+ /** Raw code to display (no trailing newline needed). */
173
+ code: string;
174
+ /** Language identifier used for Prism highlighting. */
175
+ language?: string;
176
+ /** Show a copy-to-clipboard button (default true). */
177
+ showCopyButton?: boolean;
178
+ className?: string;
179
+ };
180
+ declare const CodeBlock: React.ForwardRefExoticComponent<CodeBlockProps & React.RefAttributes<HTMLDivElement>>;
181
+
182
+ type ConfirmationStatus = 'pending' | 'approved' | 'rejected';
183
+ type ConfirmationVariant = 'default' | 'warning' | 'destructive' | 'info' | 'success';
184
+ /** Button variants accepted for the approve/reject actions (Button's variant union). */
185
+ type ConfirmationActionVariant = 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
186
+ type ConfirmationProps = {
187
+ /** Human-readable summary of the action requiring approval. */
188
+ title: string;
189
+ /** Optional detail: affected resource, arguments preview, risk note. */
190
+ description?: string;
191
+ /** Tool or action name shown as a mono chip. */
192
+ toolName?: string;
193
+ /** Controlled outcome; omit for fully interactive uncontrolled use. */
194
+ status?: ConfirmationStatus;
195
+ /** Accent color of the pending card (outcome chips always follow the result). */
196
+ variant?: ConfirmationVariant;
197
+ onApprove?: () => void;
198
+ onReject?: () => void;
199
+ /** Button styling for the approve/reject actions. */
200
+ approveVariant?: ConfirmationActionVariant;
201
+ rejectVariant?: ConfirmationActionVariant;
202
+ /** Hide the action buttons (controlled-only gate; status drives the chip). */
203
+ showActions?: boolean;
204
+ labels?: {
205
+ approve?: string;
206
+ reject?: string;
207
+ approved?: string;
208
+ rejected?: string;
209
+ };
210
+ className?: string;
211
+ };
212
+ /**
213
+ * Human-in-the-loop approval gate for agent actions (tool execution,
214
+ * destructive operations). The agent pauses until the user decides.
215
+ */
216
+ declare const Confirmation: React.ForwardRefExoticComponent<ConfirmationProps & React.RefAttributes<HTMLDivElement>>;
217
+
218
+ type BranchProps = {
219
+ /** Total number of message variants. Renders nothing when count < 2. */
220
+ count: number;
221
+ /** Zero-based index of the currently displayed variant. */
222
+ selected?: number;
223
+ /** Uncontrolled initial variant when `selected` is omitted. */
224
+ defaultSelected?: number;
225
+ onSelect?: (index: number) => void;
226
+ labels?: {
227
+ previous?: string;
228
+ next?: string;
229
+ };
230
+ className?: string;
231
+ };
232
+ /**
233
+ * Variant navigation for branched messages (`‹ 2 / 3 ›`).
234
+ * Purely presentational + minimal internal state; the consumer swaps content.
235
+ */
236
+ declare const Branch: React.ForwardRefExoticComponent<BranchProps & React.RefAttributes<HTMLDivElement>>;
237
+
238
+ type InlineCitationProps = {
239
+ /** The cited source; powers the hover/focus preview card. */
240
+ source: SourceItem;
241
+ /** Citation text to wrap (defaults to the source title). */
242
+ children?: React.ReactNode;
243
+ className?: string;
244
+ };
245
+ /**
246
+ * Perplexity-style inline citation: a superscript chip that reveals the
247
+ * source snippet on hover or keyboard focus.
248
+ */
249
+ declare const InlineCitation: React.ForwardRefExoticComponent<InlineCitationProps & React.RefAttributes<HTMLSpanElement>>;
250
+
251
+ type ConversationProps = {
252
+ messages: Message[];
253
+ className?: string;
254
+ showAvatars?: boolean;
255
+ userAvatarSrc?: string;
256
+ userAvatarFallback?: string;
257
+ assistantAvatarSrc?: string;
258
+ assistantAvatarFallback?: string;
259
+ isLoading?: boolean;
260
+ loadingMessage?: string;
261
+ /** Custom content renderer applied to every message (e.g. markdown). */
262
+ renderContent?: (content: string) => React.ReactNode;
263
+ /** ID of the message still being generated; renders its streaming cursor. */
264
+ streamingMessageId?: string;
265
+ /**
266
+ * Show a floating "scroll to latest" pill when the user has scrolled up.
267
+ * Default true.
268
+ */
269
+ showScrollButton?: boolean;
270
+ /** Show a download button that exports the transcript as Markdown. Default false. */
271
+ showDownload?: boolean;
272
+ /** Per-message generation failures keyed by message id; renders retry cards. */
273
+ messageErrors?: Record<string, string>;
274
+ /** Retry handler for failed messages in `messageErrors`. */
275
+ onRetryMessage?: (message: Message) => void;
276
+ /** Heading for the empty-transcript welcome state. */
277
+ welcomeTitle?: string;
278
+ /** Supporting copy for the welcome state. */
279
+ welcomeDescription?: string;
280
+ /** Starter prompts rendered as buttons under the welcome copy. */
281
+ welcomeSuggestions?: string[];
282
+ /** Called with the chosen starter prompt text. */
283
+ onWelcomeSelect?: (prompt: string) => void;
284
+ /** Older history exists; renders a "load earlier" control at the top. */
285
+ hasMoreHistory?: boolean;
286
+ /** Older history request is in flight; shows a loading row. */
287
+ isLoadingMore?: boolean;
288
+ /** Called when the user requests older history. */
289
+ onLoadMore?: () => void;
290
+ };
291
+ declare const Conversation: React.ForwardRefExoticComponent<ConversationProps & React.RefAttributes<HTMLDivElement>>;
292
+
293
+ type UseAttachmentsOptions = {
294
+ /** File types to accept, e.g. "image/*" (HTML accept syntax). */
295
+ accept?: string;
296
+ /** Maximum number of queued files. */
297
+ maxFiles?: number;
298
+ /** Maximum size per file in bytes. */
299
+ maxFileSize?: number;
300
+ multiple?: boolean;
301
+ onError?: (error: {
302
+ code: 'max_files' | 'max_file_size' | 'accept';
303
+ message: string;
304
+ }) => void;
305
+ };
306
+ type UseAttachmentsResult = {
307
+ files: AttachmentItem[];
308
+ add: (fileList: FileList | File[]) => void;
309
+ remove: (id: string) => void;
310
+ clear: () => void;
311
+ openFileDialog: () => void;
312
+ /** Hidden file input element; render it once somewhere in your tree. */
313
+ input: React.ReactElement;
314
+ };
315
+ /**
316
+ * Headless attachment queue with constraint validation.
317
+ * Used internally by PromptInput and exported for custom composers.
318
+ */
319
+ declare function usePromptInputAttachments(options?: UseAttachmentsOptions): UseAttachmentsResult;
320
+ /** Web Speech API dictation; returns supported=false on unsupported browsers. */
321
+ declare function useSpeechRecognition(onTranscript: (text: string) => void): {
322
+ supported: boolean;
323
+ isListening: boolean;
324
+ toggle: () => void;
325
+ };
326
+ type PromptInputProps = {
327
+ onSubmit: (value: string) => void;
328
+ /** Called when the user requests to stop an in-flight generation. */
329
+ onStop?: () => void;
330
+ /**
331
+ * Externally owned attachment queue. When omitted, PromptInput manages its
332
+ * own queue with drag-and-drop + clipboard-paste support.
333
+ */
334
+ attachments?: AttachmentItem[];
335
+ onRemoveAttachment?: (attachment: AttachmentItem) => void;
336
+ /** Called whenever the managed attachment queue changes. */
337
+ onAttachmentsChange?: (attachments: AttachmentItem[]) => void;
338
+ /** Marks submission as failed; the send control reflects the error state. */
339
+ hasError?: boolean;
340
+ accept?: string;
341
+ multiple?: boolean;
342
+ maxFiles?: number;
343
+ maxFileSize?: number;
344
+ onAttachmentError?: UseAttachmentsOptions['onError'];
345
+ /** Accept file drops anywhere on the document (default false). */
346
+ globalDrop?: boolean;
347
+ placeholder?: string;
348
+ disabled?: boolean;
349
+ isLoading?: boolean;
350
+ className?: string;
351
+ autoFocus?: boolean;
352
+ maxLength?: number;
353
+ showSendButton?: boolean;
354
+ sendButtonText?: string;
355
+ stopButtonText?: string;
356
+ children?: React.ReactNode;
357
+ };
358
+ declare const PromptInputRoot: React.ForwardRefExoticComponent<PromptInputProps & React.RefAttributes<HTMLTextAreaElement>>;
359
+ /** Auto-resizing textarea bound to the prompt state. Accepts standard textarea props. */
360
+ declare const PromptInputTextarea: React.ForwardRefExoticComponent<Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange" | "value"> & React.RefAttributes<HTMLTextAreaElement>>;
361
+ /** Status-aware submit control: send / stop / error icons chosen automatically. */
362
+ declare const PromptInputSubmit: React.ForwardRefExoticComponent<{
363
+ className?: string;
364
+ } & React.RefAttributes<HTMLButtonElement>>;
365
+ /** Toolbar row under the textarea. */
366
+ declare function PromptInputFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
367
+ /** Left-aligned group of tools inside a footer. */
368
+ declare function PromptInputTools({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
369
+ /** Row above the textarea (attachments, hints). */
370
+ declare function PromptInputHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
371
+ /** Wrapper around the textarea row. */
372
+ declare function PromptInputBody({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
373
+ type PromptInputButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
374
+ /** Tooltip content; optionally includes a keyboard shortcut hint. */
375
+ tooltip?: string | {
376
+ content: React.ReactNode;
377
+ shortcut?: string;
378
+ };
379
+ active?: boolean;
380
+ };
381
+ /** Small toolbar button with optional tooltip and shortcut hint. */
382
+ declare const PromptInputButton: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & {
383
+ /** Tooltip content; optionally includes a keyboard shortcut hint. */
384
+ tooltip?: string | {
385
+ content: React.ReactNode;
386
+ shortcut?: string;
387
+ };
388
+ active?: boolean;
389
+ } & React.RefAttributes<HTMLButtonElement>>;
390
+ /** Dictation toggle using the Web Speech API; hidden when unsupported. */
391
+ declare function PromptInputActionDictate({ labels }: {
392
+ labels?: {
393
+ start?: string;
394
+ stop?: string;
395
+ };
396
+ }): React.JSX.Element | null;
397
+ /** Opens the managed file picker with configured constraints. */
398
+ /** Opens the managed file picker with configured constraints. */
399
+ declare function PromptInputActionAddAttachments({ label }: {
400
+ label?: string;
401
+ }): React.JSX.Element;
402
+
403
+ type ReasoningProps = {
404
+ steps: ReasoningStep[];
405
+ className?: string;
406
+ collapsible?: boolean;
407
+ defaultExpanded?: boolean;
408
+ /** Elapsed thinking time, e.g. 4 (seconds) or "4s"; rendered in the header. */
409
+ duration?: number | string;
410
+ /** Marks reasoning as still arriving: animated header state. */
411
+ isStreaming?: boolean;
412
+ };
413
+ declare const Reasoning: React.ForwardRefExoticComponent<ReasoningProps & React.RefAttributes<HTMLDivElement>>;
414
+
415
+ type ToolCallProps = {
416
+ toolCall: ToolCall$1;
417
+ className?: string;
418
+ showResult?: boolean;
419
+ };
420
+ /**
421
+ * Displays a single tool invocation: name, status chip, serialized
422
+ * arguments, optional result, and an error block on failure.
423
+ */
424
+ declare const ToolCall: React.ForwardRefExoticComponent<ToolCallProps & React.RefAttributes<HTMLDivElement>>;
425
+
426
+ type SourceProps = {
427
+ source: SourceItem;
428
+ /**
429
+ * 1-based citation marker rendered as a `[n]` prefix.
430
+ * Omit to render the citation without numbering.
431
+ */
432
+ index?: number;
433
+ className?: string;
434
+ };
435
+ declare const Source: React.ForwardRefExoticComponent<SourceProps & React.RefAttributes<HTMLDivElement>>;
436
+
437
+ type SourcesProps = {
438
+ sources: SourceItem[];
439
+ className?: string;
440
+ maxDisplay?: number;
441
+ /** Heading label; override for localization. */
442
+ label?: string;
443
+ };
444
+ declare const Sources: React.ForwardRefExoticComponent<SourcesProps & React.RefAttributes<HTMLDivElement>>;
445
+
446
+ type Suggestion = {
447
+ id: string;
448
+ text: string;
449
+ type?: 'action' | 'query' | 'follow-up';
450
+ };
451
+ type SuggestionsProps = {
452
+ suggestions: Suggestion[];
453
+ onSelect?: (suggestion: Suggestion) => void;
454
+ className?: string;
455
+ maxDisplay?: number;
456
+ };
457
+ declare const Suggestions: React.ForwardRefExoticComponent<SuggestionsProps & React.RefAttributes<HTMLDivElement>>;
458
+
459
+ type ChainThoughtStep = {
460
+ id: string;
461
+ content: string;
462
+ status?: 'pending' | 'completed' | 'failed';
463
+ };
464
+ type ChainThoughtProps = {
465
+ steps: ChainThoughtStep[];
466
+ className?: string;
467
+ compact?: boolean;
468
+ };
469
+ declare const ChainThought: React.ForwardRefExoticComponent<ChainThoughtProps & React.RefAttributes<HTMLDivElement>>;
470
+
471
+ type StreamingIndicatorProps = {
472
+ isStreaming: boolean;
473
+ className?: string;
474
+ text?: string;
475
+ };
476
+ /**
477
+ * Animated three-dot streaming indicator. Announces the streaming state
478
+ * to screen readers via role="status" / aria-live so assistive tech
479
+ * users know generation is in progress.
480
+ */
481
+ declare const StreamingIndicator: React.ForwardRefExoticComponent<StreamingIndicatorProps & React.RefAttributes<HTMLDivElement>>;
482
+
483
+ type Command = {
484
+ id: string;
485
+ label: string;
486
+ /** Optional grouping header, e.g. "Navigation". */
487
+ section?: string;
488
+ /** Extra lexical search terms. */
489
+ keywords?: string[];
490
+ shortcut?: string;
491
+ };
492
+ type CommandPaletteProps = {
493
+ open: boolean;
494
+ onOpenChange: (open: boolean) => void;
495
+ commands: Command[];
496
+ onSelect: (command: Command) => void;
497
+ placeholder?: string;
498
+ };
499
+ /**
500
+ * Cmd+K command palette: combobox + listbox with aria-activedescendant
501
+ * keyboard navigation, lexical filtering over label/keywords, and
502
+ * Escape-to-close. No focus leaves the input while navigating.
503
+ */
504
+ declare function CommandPalette({ open, onOpenChange, commands, onSelect, placeholder, }: CommandPaletteProps): React.JSX.Element | null;
505
+
506
+ /**
507
+ * Structural types mirroring the parts of the Vercel AI SDK's chat state the
508
+ * adapter consumes. Declared locally (instead of importing the SDK) so the
509
+ * adapter stays runtime-independent: any chat library that produces this
510
+ * shape can be bridged, and consumers install the SDK themselves.
511
+ */
512
+ type AiSdkToolInvocation = {
513
+ toolCallId: string;
514
+ toolName: string;
515
+ args?: Record<string, unknown>;
516
+ /** AI SDK states: 'call' (pending), 'result' (completed), 'error'. */
517
+ state?: string;
518
+ result?: unknown;
519
+ error?: unknown;
520
+ };
521
+ type AiSdkMessage = {
522
+ id: string;
523
+ role: 'user' | 'assistant' | 'system' | 'tool';
524
+ content: string;
525
+ toolInvocations?: AiSdkToolInvocation[];
526
+ };
527
+ type AiSdkStatus = string;
528
+
529
+ /** Map one AI SDK tool invocation to a Slipstream ToolCall data object. */
530
+ declare function toSlipstreamToolCall(invocation: AiSdkToolInvocation): ToolCall$1;
531
+ /** Extract every tool call carried by an AI SDK message. */
532
+ declare function toSlipstreamToolCalls(message: AiSdkMessage): ToolCall$1[];
533
+ /**
534
+ * Map one AI SDK message onto a Slipstream Message. Tool invocations are
535
+ * preserved under `metadata.toolCalls` (and via toSlipstreamToolCalls) so
536
+ * ToolCall components can render them.
537
+ */
538
+ declare function toSlipstreamMessage(message: AiSdkMessage): Message;
539
+ /** Map a useChat/useCompletion message list into Slipstream messages. */
540
+ declare function toSlipstreamMessages(messages: AiSdkMessage[]): Message[];
541
+
542
+ type UseSlipstreamMessagesOptions = {
543
+ /** `messages` from the AI SDK's useChat()/useCompletion() state. */
544
+ messages: AiSdkMessage[];
545
+ };
546
+ type UseSlipstreamMessagesResult = {
547
+ messages: Message[];
548
+ };
549
+ /**
550
+ * Bridge AI SDK chat messages to Slipstream `<Conversation>`/`<Message>`
551
+ * input. Pure derivation of the current state — safe to call from any
552
+ * runtime that provides the structural message shape.
553
+ */
554
+ declare function useSlipstreamMessages({ messages }: UseSlipstreamMessagesOptions): UseSlipstreamMessagesResult;
555
+ type UseSlipstreamStreamOptions = {
556
+ /** `status` from the AI SDK chat state. */
557
+ status?: AiSdkStatus;
558
+ /** `error` from the AI SDK chat state. */
559
+ error?: unknown;
560
+ /** Retry handler wired to the SDK's reload/retry (e.g. `reload`). */
561
+ onRetry?: () => void;
562
+ /** Messages from the SDK chat state; used to locate the streaming id. */
563
+ messages?: AiSdkMessage[];
564
+ };
565
+ type UseSlipstreamStreamResult = {
566
+ isLoading: boolean;
567
+ streamingMessageId?: string;
568
+ messageErrors?: Record<string, string>;
569
+ onRetryMessage?: (messageId: string) => void;
570
+ };
571
+ /**
572
+ * Bridge AI SDK stream status/error to Slipstream Conversation props:
573
+ * `isLoading` gates the loading row, `streamingMessageId` drives the typing
574
+ * cursor on the last assistant message, and errors map to retryable
575
+ * per-message failures (streaming/tool states).
576
+ */
577
+ declare function useSlipstreamStream({ status, error, onRetry, messages, }: UseSlipstreamStreamOptions): UseSlipstreamStreamResult;
578
+
579
+ export { type AiSdkMessage, type AiSdkStatus, type AiSdkToolInvocation, Attachment, type AttachmentItem, AttachmentList, type AttachmentListProps, type AttachmentProps, Branch, type BranchProps, ChainThought, type ChainThoughtProps, type ChainThoughtStep, CodeBlock, type CodeBlockProps, type Command, CommandPalette, type CommandPaletteProps, Confirmation, type ConfirmationProps, type ConfirmationStatus, Conversation, type ConversationProps, type FeedbackRating, InlineCitation, type InlineCitationProps, MemoizedMessage as Message, MessageActions, type MessageActionsProps, type Message as MessageData, type MessageProps, type MessageRole, PromptInputRoot as PromptInput, PromptInputActionAddAttachments, PromptInputActionDictate, PromptInputBody, PromptInputButton, type PromptInputButtonProps, PromptInputFooter, PromptInputHeader, type PromptInputProps, PromptInputSubmit, PromptInputTextarea, PromptInputTools, Reasoning, type ReasoningProps, type ReasoningStep, Response, type ResponseProps, Source, type SourceItem, type SourceProps, Sources, type SourcesProps, StreamingIndicator, type StreamingIndicatorProps, type Suggestion, Suggestions, type SuggestionsProps, ToolCall, type ToolCall$1 as ToolCallData, type ToolCallProps, type UseAttachmentsOptions, type UseAttachmentsResult, type UseSlipstreamMessagesOptions, type UseSlipstreamMessagesResult, type UseSlipstreamStreamOptions, type UseSlipstreamStreamResult, closeIncompleteMarkdown, toSlipstreamMessage, toSlipstreamMessages, toSlipstreamToolCall, toSlipstreamToolCalls, usePromptInputAttachments, useSlipstreamMessages, useSlipstreamStream, useSpeechRecognition };