@mcp-b/react-components 0.3.0 → 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.
@@ -1,7 +1,8 @@
1
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { n as ArrowLeftIcon, r as ArrowRightIcon } from "../icons-DQC4Zw5R.js";
2
+ import { h as FileIcon, n as ArrowLeftIcon, r as ArrowRightIcon } from "../icons-DQC4Zw5R.js";
3
3
  import { Button } from "./Button.js";
4
4
  import { Tooltip, TooltipPopup, TooltipPortal, TooltipPositioner, TooltipTrigger } from "./Tooltip.js";
5
+ import { t as AttachmentPreview } from "../attachment-preview-ChtC3HiU.js";
5
6
  import * as React from "react";
6
7
  import { jsx, jsxs } from "react/jsx-runtime";
7
8
  import { cjk } from "@streamdown/cjk";
@@ -66,6 +67,39 @@ const MessageResponse = React.memo(function MessageResponse({ className, ...prop
66
67
  });
67
68
  });
68
69
  /**
70
+ * A `file` part inside a message: images render inline (click to zoom),
71
+ * anything else becomes a download chip. Covers both directions — files the
72
+ * user attached and files the agent emitted.
73
+ */
74
+ function MessageAttachment({ part, className, ...props }) {
75
+ const name = part.filename ?? (part.mediaType || "attachment");
76
+ if (part.mediaType.startsWith("image/")) return /* @__PURE__ */ jsx(AttachmentPreview, {
77
+ url: part.url,
78
+ filename: part.filename,
79
+ children: /* @__PURE__ */ jsx("button", {
80
+ type: "button",
81
+ className: cx("message__attachment-zoom", className),
82
+ "aria-label": `Preview ${name}`,
83
+ ...props,
84
+ children: /* @__PURE__ */ jsx("img", {
85
+ className: "message__attachment-image",
86
+ src: part.url,
87
+ alt: part.filename ?? "Attached image"
88
+ })
89
+ })
90
+ });
91
+ return /* @__PURE__ */ jsxs("a", {
92
+ className: cx("message__attachment", className),
93
+ href: part.url,
94
+ download: part.filename,
95
+ ...props,
96
+ children: [/* @__PURE__ */ jsx(FileIcon, { className: "message__attachment-icon" }), /* @__PURE__ */ jsx("span", {
97
+ className: "message__attachment-name",
98
+ children: name
99
+ })]
100
+ });
101
+ }
102
+ /**
69
103
  * Horizontal list of action buttons (copy, retry, thumbs-up, etc.) shown
70
104
  * alongside or beneath a message.
71
105
  */
@@ -242,4 +276,4 @@ function MessageBranchPage({ className, format, ref, ...props }) {
242
276
  });
243
277
  }
244
278
  //#endregion
245
- export { Message, MessageAction, MessageActions, MessageBranch, MessageBranchContent, MessageBranchNext, MessageBranchPage, MessageBranchPrevious, MessageBranchSelector, MessageContent, MessageResponse, MessageToolbar };
279
+ export { Message, MessageAction, MessageActions, MessageAttachment, MessageBranch, MessageBranchContent, MessageBranchNext, MessageBranchPage, MessageBranchPrevious, MessageBranchSelector, MessageContent, MessageResponse, MessageToolbar };
@@ -1,4 +1,5 @@
1
1
  import { Accordion, AccordionItem, AccordionPanel, AccordionTrigger } from "./Accordion.js";
2
+ import { Separator } from "./Separator.js";
2
3
  import { Button } from "./Button.js";
3
4
  import { Tooltip, TooltipPopup, TooltipPortal, TooltipPositioner, TooltipTrigger } from "./Tooltip.js";
4
5
  import { Badge } from "./Badge.js";
@@ -6,7 +7,6 @@ import { AlertDialog, AlertDialogBackdrop, AlertDialogClose, AlertDialogDescript
6
7
  import { Slider, SliderControl, SliderIndicator, SliderThumb, SliderTrack } from "./Slider.js";
7
8
  import { Card } from "./Card.js";
8
9
  import { Checkbox } from "./Checkbox.js";
9
- import { Separator } from "./Separator.js";
10
10
  import { Switch, SwitchThumb } from "./Switch.js";
11
11
  import { Label } from "./Label.js";
12
12
  import { ToggleGroup, ToggleGroupItem } from "./ToggleGroup.js";
@@ -1,2 +1,532 @@
1
- import { $ as PromptInputProviderProps, A as PromptInputCommandInputProps, At as TextInputContext, B as PromptInputFooter, C as PromptInputButtonTooltip, Ct as PromptInputTabsListProps, D as PromptInputCommandGroup, Dt as PromptInputToolsProps, E as PromptInputCommandEmptyProps, Et as PromptInputTools, F as PromptInputCommandProps, Ft as usePromptInputReferencedSources, G as PromptInputHoverCardContent, H as PromptInputHeader, I as PromptInputCommandSeparator, It as useProviderAttachments, J as PromptInputHoverCardTrigger, K as PromptInputHoverCardContentProps, L as PromptInputCommandSeparatorProps, M as PromptInputCommandItemProps, Mt as getPendingToolApprovals, N as PromptInputCommandList, Nt as usePromptInputAttachments, O as PromptInputCommandGroupProps, Ot as PromptInputTooltipConfig, P as PromptInputCommandListProps, Pt as usePromptInputController, Q as PromptInputProvider, R as PromptInputControllerProps, S as PromptInputButtonProps, St as PromptInputTabsList, T as PromptInputCommandEmpty, Tt as PromptInputTextareaProps, U as PromptInputHeaderProps, V as PromptInputFooterProps, W as PromptInputHoverCard, X as PromptInputMessage, Y as PromptInputHoverCardTriggerProps, Z as PromptInputProps, _ as PromptInputApproval, _t as PromptInputTabItem, a as PromptInputActionAddAttachments, at as PromptInputSelectItemProps, b as PromptInputBodyProps, bt as PromptInputTabLabelProps, c as PromptInputActionAddScreenshotProps, ct as PromptInputSelectTriggerProps, d as PromptInputActionMenuContentProps, dt as PromptInputStatus, et as PromptInputReferencedSource, f as PromptInputActionMenuItem, ft as PromptInputSubmit, g as PromptInputActionMenuTriggerProps, gt as PromptInputTabBodyProps, h as PromptInputActionMenuTrigger, ht as PromptInputTabBody, i as PromptInput, it as PromptInputSelectItem, j as PromptInputCommandItem, jt as TooltipSide, k as PromptInputCommandInput, kt as ReferencedSourcesContext, l as PromptInputActionMenu, lt as PromptInputSelectValue, m as PromptInputActionMenuProps, mt as PromptInputTab, n as AttachmentsContext, nt as PromptInputSelectContent, o as PromptInputActionAddAttachmentsProps, ot as PromptInputSelectProps, p as PromptInputActionMenuItemProps, pt as PromptInputSubmitProps, q as PromptInputHoverCardProps, r as PendingToolApproval, rt as PromptInputSelectContentProps, s as PromptInputActionAddScreenshot, st as PromptInputSelectTrigger, t as ApprovalToolPart, tt as PromptInputSelect, u as PromptInputActionMenuContent, ut as PromptInputSelectValueProps, v as PromptInputApprovalProps, vt as PromptInputTabItemProps, w as PromptInputCommand, wt as PromptInputTextarea, x as PromptInputButton, xt as PromptInputTabProps, y as PromptInputBody, yt as PromptInputTabLabel, z as PromptInputFilePart } from "../PromptInput-Dzn-fOPc.js";
2
- export { ApprovalToolPart, AttachmentsContext, PendingToolApproval, PromptInput, PromptInputActionAddAttachments, PromptInputActionAddAttachmentsProps, PromptInputActionAddScreenshot, PromptInputActionAddScreenshotProps, PromptInputActionMenu, PromptInputActionMenuContent, PromptInputActionMenuContentProps, PromptInputActionMenuItem, PromptInputActionMenuItemProps, PromptInputActionMenuProps, PromptInputActionMenuTrigger, PromptInputActionMenuTriggerProps, PromptInputApproval, PromptInputApprovalProps, PromptInputBody, PromptInputBodyProps, PromptInputButton, PromptInputButtonProps, PromptInputButtonTooltip, PromptInputCommand, PromptInputCommandEmpty, PromptInputCommandEmptyProps, PromptInputCommandGroup, PromptInputCommandGroupProps, PromptInputCommandInput, PromptInputCommandInputProps, PromptInputCommandItem, PromptInputCommandItemProps, PromptInputCommandList, PromptInputCommandListProps, PromptInputCommandProps, PromptInputCommandSeparator, PromptInputCommandSeparatorProps, PromptInputControllerProps, PromptInputFilePart, PromptInputFooter, PromptInputFooterProps, PromptInputHeader, PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, PromptInputHoverCardContentProps, PromptInputHoverCardProps, PromptInputHoverCardTrigger, PromptInputHoverCardTriggerProps, PromptInputMessage, PromptInputProps, PromptInputProvider, PromptInputProviderProps, PromptInputReferencedSource, PromptInputSelect, PromptInputSelectContent, PromptInputSelectContentProps, PromptInputSelectItem, PromptInputSelectItemProps, PromptInputSelectProps, PromptInputSelectTrigger, PromptInputSelectTriggerProps, PromptInputSelectValue, PromptInputSelectValueProps, PromptInputStatus, PromptInputSubmit, PromptInputSubmitProps, PromptInputTab, PromptInputTabBody, PromptInputTabBodyProps, PromptInputTabItem, PromptInputTabItemProps, PromptInputTabLabel, PromptInputTabLabelProps, PromptInputTabProps, PromptInputTabsList, PromptInputTabsListProps, PromptInputTextarea, PromptInputTextareaProps, PromptInputTools, PromptInputToolsProps, PromptInputTooltipConfig, ReferencedSourcesContext, TextInputContext, TooltipSide, getPendingToolApprovals, usePromptInputAttachments, usePromptInputController, usePromptInputReferencedSources, useProviderAttachments };
1
+ import { A as SelectTriggerProps, M as SelectValueProps, S as SelectProps, f as SelectOption, j as SelectValue, r as SelectContentProps, s as SelectItemProps, t as Select } from "../Select-CRsKCJ9x.js";
2
+ import { c as ComboboxGroup, d as ComboboxLabel, f as ComboboxList, g as ComboboxTrigger, h as ComboboxSeparator, l as ComboboxInput, m as ComboboxPositioner, p as ComboboxPopup, s as ComboboxEmpty, t as Combobox, u as ComboboxItem } from "../Combobox-D9anamNr.js";
3
+ import { h as MenuItemProps, w as MenuProps, y as MenuPopupProps } from "../Menu-B5vDqZe_.js";
4
+ import { c as TabsList, n as TabPanel, t as Tab } from "../Tabs-D9EAq09D.js";
5
+ import { r as ButtonProps } from "../Button-Ct5I6aTu.js";
6
+ import * as React from "react";
7
+ import { ChatAddToolApproveResponseFunction, ChatStatus, DynamicToolUIPart, FileUIPart, ToolUIPart, UIMessage } from "ai";
8
+
9
+ //#region src/components/PromptInput.d.ts
10
+ /**
11
+ * The AI SDK's `FileUIPart`, taken whole — an attachment IS the `file` part
12
+ * that ends up on the sent message, so submitted files feed straight into
13
+ * `sendMessage({ text, files })`.
14
+ */
15
+ type PromptInputFilePart = FileUIPart;
16
+ interface PromptInputReferencedSource {
17
+ id?: string;
18
+ title?: string;
19
+ url?: string;
20
+ [key: string]: unknown;
21
+ }
22
+ /** The payload produced when the prompt input is submitted. */
23
+ interface PromptInputMessage {
24
+ text: string;
25
+ files: PromptInputFilePart[];
26
+ }
27
+ /** Lifecycle status of an in-flight model request — the AI SDK's `ChatStatus`. */
28
+ type PromptInputStatus = ChatStatus;
29
+ interface AttachmentsContext {
30
+ files: Array<PromptInputFilePart & {
31
+ id: string;
32
+ }>;
33
+ add: (files: File[] | FileList) => void;
34
+ remove: (id: string) => void;
35
+ clear: () => void;
36
+ openFileDialog: () => void;
37
+ fileInputRef: React.RefObject<HTMLInputElement | null>;
38
+ }
39
+ interface TextInputContext {
40
+ value: string;
41
+ setInput: (value: string) => void;
42
+ clear: () => void;
43
+ }
44
+ interface PromptInputControllerProps {
45
+ textInput: TextInputContext;
46
+ attachments: AttachmentsContext;
47
+ __registerFileInput: (ref: React.RefObject<HTMLInputElement | null>, open: () => void) => void;
48
+ }
49
+ interface ReferencedSourcesContext {
50
+ sources: Array<PromptInputReferencedSource & {
51
+ id: string;
52
+ }>;
53
+ add: (sources: PromptInputReferencedSource[] | PromptInputReferencedSource) => void;
54
+ remove: (id: string) => void;
55
+ clear: () => void;
56
+ }
57
+ declare function usePromptInputController(): PromptInputControllerProps;
58
+ declare function useProviderAttachments(): AttachmentsContext;
59
+ declare function usePromptInputAttachments(): AttachmentsContext;
60
+ declare function usePromptInputReferencedSources(): ReferencedSourcesContext;
61
+ interface PromptInputProviderProps extends React.PropsWithChildren {
62
+ initialInput?: string;
63
+ }
64
+ declare function PromptInputProvider({
65
+ initialInput,
66
+ children
67
+ }: PromptInputProviderProps): React.JSX.Element;
68
+ interface PromptInputProps extends Omit<React.FormHTMLAttributes<HTMLFormElement>, "onSubmit" | "onError"> {
69
+ /** Accepted file MIME types/extensions, passed to the hidden file input. */
70
+ accept?: string;
71
+ /** Allows multiple files in a single file picker/drop action. */
72
+ multiple?: boolean;
73
+ /** Listen for file drops on the whole document instead of only the form. */
74
+ globalDrop?: boolean;
75
+ /** Clears the hidden file input when attachments are cleared. */
76
+ syncHiddenInput?: boolean;
77
+ /** Maximum number of attached files. */
78
+ maxFiles?: number;
79
+ /** Maximum accepted file size in bytes. */
80
+ maxFileSize?: number;
81
+ /** Called when file validation rejects an attachment. */
82
+ onError?: (error: {
83
+ code: "max_files" | "max_file_size" | "accept";
84
+ message: string;
85
+ }) => void;
86
+ /** Called with the trimmed message text and files when the form is submitted. */
87
+ onSubmit?: (message: PromptInputMessage, event: React.FormEvent<HTMLFormElement>) => void | Promise<void>;
88
+ }
89
+ /**
90
+ * Chat-style composer form. Wraps a textarea and footer controls, with
91
+ * Enter-to-submit semantics, auto-resizing behavior, and optional attachments.
92
+ * Adapted from Vercel AI Elements and restyled with Sigvelo CSS tokens.
93
+ *
94
+ * Use for assistant/chat submit forms. Do not use it as a generic textarea or
95
+ * non-chat form. Sigvelo changes: uses shared Menu, Select, Combobox, Tabs,
96
+ * Button, and Tooltip components; maps styles to CSS tokens; adds local
97
+ * attachment and referenced-source helpers.
98
+ *
99
+ * The form handles Enter-to-submit while multiline editing remains in the
100
+ * textarea. Attachment controls need accessible labels through their buttons
101
+ * and menus. Add new shared tools here when multiple apps need them.
102
+ *
103
+ * @example
104
+ * ```tsx
105
+ * <PromptInput onSubmit={({ text, files }) => sendMessage(text, files)}>
106
+ * <PromptInputBody>
107
+ * <PromptInputTextarea placeholder="Ask Sigvelo..." />
108
+ * </PromptInputBody>
109
+ * <PromptInputFooter>
110
+ * <PromptInputTools>
111
+ * <PromptInputActionAddAttachments />
112
+ * </PromptInputTools>
113
+ * <PromptInputSubmit status="ready" />
114
+ * </PromptInputFooter>
115
+ * </PromptInput>
116
+ * ```
117
+ *
118
+ * @see {@link https://elements.ai-sdk.dev/components/prompt-input | AI Elements Prompt Input}
119
+ */
120
+ declare function PromptInput({
121
+ className,
122
+ accept,
123
+ multiple,
124
+ globalDrop,
125
+ syncHiddenInput,
126
+ maxFiles,
127
+ maxFileSize,
128
+ onError,
129
+ onSubmit,
130
+ children,
131
+ id,
132
+ ref,
133
+ ...props
134
+ }: PromptInputProps & {
135
+ ref?: React.Ref<HTMLFormElement>;
136
+ }): React.JSX.Element;
137
+ interface PromptInputHeaderProps extends React.HTMLAttributes<HTMLDivElement> {}
138
+ declare function PromptInputHeader({
139
+ className,
140
+ children,
141
+ ref,
142
+ ...props
143
+ }: PromptInputHeaderProps & {
144
+ ref?: React.Ref<HTMLDivElement>;
145
+ }): React.JSX.Element;
146
+ interface PromptInputAttachmentProps extends React.HTMLAttributes<HTMLDivElement> {
147
+ /** The pending attachment — the AI SDK `file` part plus the local list id. */
148
+ file: PromptInputFilePart & {
149
+ id: string;
150
+ };
151
+ }
152
+ /**
153
+ * One pending attachment chip: image files show a thumbnail, everything else
154
+ * a file icon and name. The corner button removes it from the pending list.
155
+ */
156
+ declare function PromptInputAttachment({
157
+ file,
158
+ className,
159
+ ref,
160
+ ...props
161
+ }: PromptInputAttachmentProps & {
162
+ ref?: React.Ref<HTMLDivElement>;
163
+ }): React.JSX.Element;
164
+ interface PromptInputAttachmentsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
165
+ /** Override chip rendering per attachment. */
166
+ children?: (file: PromptInputFilePart & {
167
+ id: string;
168
+ }) => React.ReactNode;
169
+ }
170
+ /**
171
+ * The pending-attachment chip row. Renders nothing while the list is empty,
172
+ * so it can sit in the composer unconditionally — files added via the file
173
+ * dialog, paste, or drop appear here until submit sends and clears them.
174
+ */
175
+ declare function PromptInputAttachments({
176
+ className,
177
+ children,
178
+ ref,
179
+ ...props
180
+ }: PromptInputAttachmentsProps & {
181
+ ref?: React.Ref<HTMLDivElement>;
182
+ }): React.JSX.Element | null;
183
+ interface PromptInputBodyProps extends React.HTMLAttributes<HTMLDivElement> {}
184
+ declare function PromptInputBody({
185
+ className,
186
+ children,
187
+ ref,
188
+ ...props
189
+ }: PromptInputBodyProps & {
190
+ ref?: React.Ref<HTMLDivElement>;
191
+ }): React.JSX.Element;
192
+ interface PromptInputFooterProps extends React.HTMLAttributes<HTMLDivElement> {}
193
+ declare function PromptInputFooter({
194
+ className,
195
+ children,
196
+ ref,
197
+ ...props
198
+ }: PromptInputFooterProps & {
199
+ ref?: React.Ref<HTMLDivElement>;
200
+ }): React.JSX.Element;
201
+ interface PromptInputToolsProps extends React.HTMLAttributes<HTMLDivElement> {}
202
+ declare function PromptInputTools({
203
+ className,
204
+ children,
205
+ ref,
206
+ ...props
207
+ }: PromptInputToolsProps & {
208
+ ref?: React.Ref<HTMLDivElement>;
209
+ }): React.JSX.Element;
210
+ interface PromptInputTextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
211
+ minHeight?: number;
212
+ maxHeight?: number;
213
+ }
214
+ declare function PromptInputTextarea({
215
+ className,
216
+ placeholder,
217
+ rows,
218
+ minHeight,
219
+ maxHeight,
220
+ onChange,
221
+ onCompositionEnd,
222
+ onCompositionStart,
223
+ onKeyDown,
224
+ onInput,
225
+ onPaste,
226
+ ref,
227
+ ...props
228
+ }: PromptInputTextareaProps & {
229
+ ref?: React.Ref<HTMLTextAreaElement>;
230
+ }): React.JSX.Element;
231
+ type TooltipSide = "top" | "right" | "bottom" | "left";
232
+ type PromptInputButtonTooltip = string | {
233
+ content: React.ReactNode;
234
+ shortcut?: string;
235
+ side?: TooltipSide;
236
+ };
237
+ type PromptInputTooltipConfig = Exclude<PromptInputButtonTooltip, string>;
238
+ interface PromptInputButtonProps extends Omit<ButtonProps, "children" | "className"> {
239
+ className?: string;
240
+ tooltip?: PromptInputButtonTooltip;
241
+ children?: React.ReactNode;
242
+ }
243
+ declare function PromptInputButton({
244
+ className,
245
+ tooltip,
246
+ variant,
247
+ color,
248
+ size,
249
+ children,
250
+ "aria-label": ariaLabel,
251
+ ref,
252
+ ...props
253
+ }: PromptInputButtonProps & {
254
+ ref?: React.Ref<HTMLButtonElement>;
255
+ }): React.JSX.Element;
256
+ type PromptInputActionMenuProps = MenuProps;
257
+ declare function PromptInputActionMenu(props: PromptInputActionMenuProps): React.JSX.Element;
258
+ type PromptInputActionMenuTriggerProps = PromptInputButtonProps;
259
+ declare function PromptInputActionMenuTrigger({
260
+ className,
261
+ children,
262
+ ...props
263
+ }: PromptInputActionMenuTriggerProps): React.JSX.Element;
264
+ type PromptInputActionMenuContentProps = MenuPopupProps;
265
+ declare function PromptInputActionMenuContent({
266
+ className,
267
+ children,
268
+ ...props
269
+ }: PromptInputActionMenuContentProps): React.JSX.Element;
270
+ type PromptInputActionMenuItemProps = MenuItemProps;
271
+ declare function PromptInputActionMenuItem({
272
+ className,
273
+ ...props
274
+ }: PromptInputActionMenuItemProps): React.JSX.Element;
275
+ interface PromptInputActionAddAttachmentsProps extends PromptInputActionMenuItemProps {
276
+ label?: string;
277
+ }
278
+ declare function PromptInputActionAddAttachments({
279
+ label,
280
+ onClick,
281
+ children,
282
+ ...props
283
+ }: PromptInputActionAddAttachmentsProps): React.JSX.Element;
284
+ interface PromptInputActionAddScreenshotProps extends PromptInputActionMenuItemProps {
285
+ label?: string;
286
+ }
287
+ declare function PromptInputActionAddScreenshot({
288
+ label,
289
+ onClick,
290
+ children,
291
+ ...props
292
+ }: PromptInputActionAddScreenshotProps): React.JSX.Element;
293
+ /** How the agent's approval requests are handled. */
294
+ type PermissionMode = "ask" | "bypass";
295
+ interface PromptInputPermissionSelectorProps {
296
+ /** Current mode. `"ask"` surfaces approvals in the composer; `"bypass"` auto-approves. */
297
+ value: PermissionMode;
298
+ onValueChange: (mode: PermissionMode) => void;
299
+ /** Overrides the menu's header question. */
300
+ question?: string;
301
+ }
302
+ /**
303
+ * Footer control for choosing how approval requests are handled — ask each
304
+ * time, or bypass. Purely a picker: the auto-approve behavior lives with
305
+ * whoever owns the approvals (`AgentChat` wires both ends).
306
+ */
307
+ declare function PromptInputPermissionSelector({
308
+ value,
309
+ onValueChange,
310
+ question
311
+ }: PromptInputPermissionSelectorProps): React.JSX.Element;
312
+ interface PromptInputSubmitProps extends Omit<ButtonProps, "children" | "className" | "type"> {
313
+ className?: string;
314
+ status?: PromptInputStatus;
315
+ onStop?: () => void;
316
+ children?: React.ReactNode;
317
+ label?: string;
318
+ }
319
+ declare function PromptInputSubmit({
320
+ className,
321
+ status,
322
+ onStop,
323
+ variant,
324
+ color,
325
+ size,
326
+ onClick,
327
+ children,
328
+ label,
329
+ ref,
330
+ ...props
331
+ }: PromptInputSubmitProps & {
332
+ ref?: React.Ref<HTMLButtonElement>;
333
+ }): React.JSX.Element;
334
+ /** A tool part that may carry a pending approval request. Upstream AI SDK types, taken whole. */
335
+ type ApprovalToolPart = ToolUIPart | DynamicToolUIPart;
336
+ /**
337
+ * Resolve paused codemode executions (`execute` / `browser_execute`) in the
338
+ * same composer approval UI as AI SDK tool approvals. Wire to the Think
339
+ * agent's client-callable RPCs — they ride the `useAgent` stub, not the chat
340
+ * socket, which is why this package can't reach them itself:
341
+ *
342
+ * ```tsx
343
+ * executionApprovals={{
344
+ * approve: (id) => agent.stub.approveExecution(id),
345
+ * reject: (id, reason) => agent.stub.rejectExecution(id, reason),
346
+ * }}
347
+ * ```
348
+ *
349
+ * On approve, upstream resumes the run, replaces the paused tool output in the
350
+ * transcript, and auto-continues the chat — no client bookkeeping needed.
351
+ * Both RPCs are idempotent, so a stale click resolves to "already handled".
352
+ */
353
+ interface ExecutionApprovals {
354
+ approve: (executionId: string) => unknown;
355
+ reject: (executionId: string, reason?: string) => unknown;
356
+ }
357
+ /** The id a response must carry: the approval id, or the paused run's executionId. */
358
+ declare function getApprovalRequestId(part: ApprovalToolPart): string | undefined;
359
+ interface PendingToolApproval<MessageT extends UIMessage = UIMessage> {
360
+ message: MessageT;
361
+ messageIndex: number;
362
+ part: ApprovalToolPart;
363
+ partIndex: number;
364
+ }
365
+ /** Derives pending tool approvals straight from the messages — no app-owned shapes. */
366
+ declare function getPendingToolApprovals<MessageT extends UIMessage>(messages: readonly MessageT[], {
367
+ pausedExecutions
368
+ }?: {
369
+ pausedExecutions?: boolean;
370
+ }): Array<PendingToolApproval<MessageT>>;
371
+ interface PromptInputApprovalProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "part"> {
372
+ /**
373
+ * The `approval-requested` tool part — or a paused codemode execution —
374
+ * passed whole. Renders nothing for other states.
375
+ */
376
+ part: ApprovalToolPart;
377
+ /** Pass `addToolApprovalResponse` from `useAgentChat`/`useChat` directly. */
378
+ onRespond?: ChatAddToolApproveResponseFunction;
379
+ /** Resolves paused executions instead of `onRespond`. See {@link ExecutionApprovals}. */
380
+ executionApprovals?: ExecutionApprovals;
381
+ /**
382
+ * Renders a Skip action that dismisses the confirmation without responding —
383
+ * the approval stays pending upstream.
384
+ */
385
+ onSkip?: () => void;
386
+ /** Overrides the default "Do you want to allow…" question. */
387
+ question?: React.ReactNode;
388
+ /** Total pending approvals, for the "1 of N" hint. */
389
+ count?: number;
390
+ }
391
+ /**
392
+ * The composer's approval state: when a tool call awaits human approval the
393
+ * prompt input area becomes the confirmation. "Yes" approves on click; typing
394
+ * in the "No, and tell the agent what to do differently" row selects deny and
395
+ * sends the text as the native approval `reason`. Submit (or Enter) sends the
396
+ * current selection — approve by default.
397
+ */
398
+ declare function PromptInputApproval({
399
+ part,
400
+ onRespond,
401
+ executionApprovals,
402
+ onSkip,
403
+ question,
404
+ count,
405
+ className,
406
+ ref,
407
+ ...props
408
+ }: PromptInputApprovalProps & {
409
+ ref?: React.Ref<HTMLDivElement>;
410
+ }): React.JSX.Element | null;
411
+ type PromptInputSelectProps = SelectProps;
412
+ declare const PromptInputSelect: typeof Select;
413
+ type PromptInputSelectTriggerProps = SelectTriggerProps;
414
+ declare function PromptInputSelectTrigger(props: PromptInputSelectTriggerProps): React.JSX.Element;
415
+ type PromptInputSelectContentProps = SelectContentProps;
416
+ declare function PromptInputSelectContent(props: PromptInputSelectContentProps): React.JSX.Element;
417
+ type PromptInputSelectItemProps = SelectItemProps;
418
+ declare const PromptInputSelectItem: typeof SelectOption;
419
+ type PromptInputSelectValueProps = SelectValueProps;
420
+ declare const PromptInputSelectValue: typeof SelectValue;
421
+ interface PromptInputHoverCardProps extends React.HTMLAttributes<HTMLDivElement> {
422
+ openDelay?: number;
423
+ closeDelay?: number;
424
+ }
425
+ declare function PromptInputHoverCard({
426
+ openDelay,
427
+ closeDelay,
428
+ className,
429
+ children,
430
+ ref,
431
+ ...props
432
+ }: PromptInputHoverCardProps & {
433
+ ref?: React.Ref<HTMLDivElement>;
434
+ }): React.JSX.Element;
435
+ interface PromptInputHoverCardTriggerProps extends React.HTMLAttributes<HTMLSpanElement> {}
436
+ declare function PromptInputHoverCardTrigger({
437
+ className,
438
+ ref,
439
+ ...props
440
+ }: PromptInputHoverCardTriggerProps & {
441
+ ref?: React.Ref<HTMLSpanElement>;
442
+ }): React.JSX.Element;
443
+ interface PromptInputHoverCardContentProps extends React.HTMLAttributes<HTMLDivElement> {}
444
+ declare function PromptInputHoverCardContent({
445
+ className,
446
+ ref,
447
+ ...props
448
+ }: PromptInputHoverCardContentProps & {
449
+ ref?: React.Ref<HTMLDivElement>;
450
+ }): React.JSX.Element | null;
451
+ type PromptInputTabsListProps = React.ComponentPropsWithoutRef<typeof TabsList>;
452
+ declare const PromptInputTabsList: typeof TabsList;
453
+ type PromptInputTabProps = React.ComponentPropsWithoutRef<typeof Tab>;
454
+ declare const PromptInputTab: typeof Tab;
455
+ type PromptInputTabBodyProps = React.ComponentPropsWithoutRef<typeof TabPanel>;
456
+ declare const PromptInputTabBody: typeof TabPanel;
457
+ interface PromptInputTabLabelProps extends React.HTMLAttributes<HTMLHeadingElement> {}
458
+ declare function PromptInputTabLabel({
459
+ className,
460
+ ref,
461
+ ...props
462
+ }: PromptInputTabLabelProps & {
463
+ ref?: React.Ref<HTMLHeadingElement>;
464
+ }): React.JSX.Element;
465
+ interface PromptInputTabItemProps extends React.HTMLAttributes<HTMLDivElement> {}
466
+ declare function PromptInputTabItem({
467
+ className,
468
+ ref,
469
+ ...props
470
+ }: PromptInputTabItemProps & {
471
+ ref?: React.Ref<HTMLDivElement>;
472
+ }): React.JSX.Element;
473
+ type PromptInputCommandProps = React.ComponentPropsWithoutRef<typeof Combobox>;
474
+ declare const PromptInputCommand: typeof import("@base-ui/react").ComboboxRoot & {
475
+ Root: typeof import("@base-ui/react").ComboboxRoot;
476
+ Input: typeof ComboboxInput;
477
+ Trigger: typeof ComboboxTrigger;
478
+ Clear: ({
479
+ className,
480
+ ref,
481
+ ...props
482
+ }: Omit<React.ComponentPropsWithRef<typeof import("@base-ui/react").ComboboxClear>, "className"> & {
483
+ className?: string;
484
+ } & {
485
+ ref?: React.Ref<HTMLButtonElement>;
486
+ }) => React.JSX.Element;
487
+ Portal: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompletePortalProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
488
+ Positioner: typeof ComboboxPositioner;
489
+ Popup: typeof ComboboxPopup;
490
+ Content: typeof ComboboxPopup;
491
+ List: typeof ComboboxList;
492
+ Item: typeof ComboboxItem;
493
+ ItemIndicator: ({
494
+ className,
495
+ ref,
496
+ ...props
497
+ }: Omit<React.ComponentPropsWithRef<typeof import("@base-ui/react").ComboboxItemIndicator>, "className"> & {
498
+ className?: string;
499
+ } & {
500
+ ref?: React.Ref<HTMLSpanElement>;
501
+ }) => React.JSX.Element;
502
+ Empty: typeof ComboboxEmpty;
503
+ Group: typeof ComboboxGroup;
504
+ GroupLabel: typeof ComboboxLabel;
505
+ Label: typeof ComboboxLabel;
506
+ Value: typeof import("@base-ui/react").ComboboxValue;
507
+ Chips: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").ComboboxChipsProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
508
+ Chip: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").ComboboxChipProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
509
+ ChipsInput: typeof ComboboxInput;
510
+ Collection: typeof import("@base-ui/react").ComboboxCollection;
511
+ Separator: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").SeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
512
+ };
513
+ type PromptInputCommandInputProps = React.ComponentPropsWithoutRef<typeof ComboboxInput>;
514
+ declare const PromptInputCommandInput: typeof ComboboxInput;
515
+ interface PromptInputCommandListProps extends React.HTMLAttributes<HTMLDivElement> {}
516
+ declare function PromptInputCommandList({
517
+ className,
518
+ ref,
519
+ ...props
520
+ }: PromptInputCommandListProps & {
521
+ ref?: React.Ref<HTMLDivElement>;
522
+ }): React.JSX.Element;
523
+ type PromptInputCommandEmptyProps = React.ComponentPropsWithoutRef<typeof ComboboxEmpty>;
524
+ declare const PromptInputCommandEmpty: typeof ComboboxEmpty;
525
+ type PromptInputCommandGroupProps = React.ComponentPropsWithoutRef<typeof ComboboxGroup>;
526
+ declare const PromptInputCommandGroup: typeof ComboboxGroup;
527
+ type PromptInputCommandItemProps = React.ComponentPropsWithoutRef<typeof ComboboxItem>;
528
+ declare const PromptInputCommandItem: typeof ComboboxItem;
529
+ type PromptInputCommandSeparatorProps = React.ComponentPropsWithoutRef<typeof ComboboxSeparator>;
530
+ declare const PromptInputCommandSeparator: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").SeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
531
+ //#endregion
532
+ export { ApprovalToolPart, AttachmentsContext, ExecutionApprovals, PendingToolApproval, PermissionMode, PromptInput, PromptInputActionAddAttachments, PromptInputActionAddAttachmentsProps, PromptInputActionAddScreenshot, PromptInputActionAddScreenshotProps, PromptInputActionMenu, PromptInputActionMenuContent, PromptInputActionMenuContentProps, PromptInputActionMenuItem, PromptInputActionMenuItemProps, PromptInputActionMenuProps, PromptInputActionMenuTrigger, PromptInputActionMenuTriggerProps, PromptInputApproval, PromptInputApprovalProps, PromptInputAttachment, PromptInputAttachmentProps, PromptInputAttachments, PromptInputAttachmentsProps, PromptInputBody, PromptInputBodyProps, PromptInputButton, PromptInputButtonProps, PromptInputButtonTooltip, PromptInputCommand, PromptInputCommandEmpty, PromptInputCommandEmptyProps, PromptInputCommandGroup, PromptInputCommandGroupProps, PromptInputCommandInput, PromptInputCommandInputProps, PromptInputCommandItem, PromptInputCommandItemProps, PromptInputCommandList, PromptInputCommandListProps, PromptInputCommandProps, PromptInputCommandSeparator, PromptInputCommandSeparatorProps, PromptInputControllerProps, PromptInputFilePart, PromptInputFooter, PromptInputFooterProps, PromptInputHeader, PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, PromptInputHoverCardContentProps, PromptInputHoverCardProps, PromptInputHoverCardTrigger, PromptInputHoverCardTriggerProps, PromptInputMessage, PromptInputPermissionSelector, PromptInputPermissionSelectorProps, PromptInputProps, PromptInputProvider, PromptInputProviderProps, PromptInputReferencedSource, PromptInputSelect, PromptInputSelectContent, PromptInputSelectContentProps, PromptInputSelectItem, PromptInputSelectItemProps, PromptInputSelectProps, PromptInputSelectTrigger, PromptInputSelectTriggerProps, PromptInputSelectValue, PromptInputSelectValueProps, PromptInputStatus, PromptInputSubmit, PromptInputSubmitProps, PromptInputTab, PromptInputTabBody, PromptInputTabBodyProps, PromptInputTabItem, PromptInputTabItemProps, PromptInputTabLabel, PromptInputTabLabelProps, PromptInputTabProps, PromptInputTabsList, PromptInputTabsListProps, PromptInputTextarea, PromptInputTextareaProps, PromptInputTools, PromptInputToolsProps, PromptInputTooltipConfig, ReferencedSourcesContext, TextInputContext, TooltipSide, getApprovalRequestId, getPendingToolApprovals, usePromptInputAttachments, usePromptInputController, usePromptInputReferencedSources, useProviderAttachments };