@mcp-b/react-components 0.1.5 → 0.2.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.
Files changed (101) hide show
  1. package/dist/{CodeBlock-CttHhWcb.js → CodeBlock-BrCoypnc.js} +2 -2
  2. package/dist/Combobox-D9anamNr.d.ts +177 -0
  3. package/dist/Menu-B5vDqZe_.d.ts +395 -0
  4. package/dist/Tabs-D9EAq09D.d.ts +84 -0
  5. package/dist/components/Activity.d.ts +148 -0
  6. package/dist/components/Activity.js +177 -0
  7. package/dist/components/AgentChat.d.ts +61 -0
  8. package/dist/components/AgentChat.js +91 -0
  9. package/dist/components/AgentConnection.js +2 -2
  10. package/dist/components/Artifact.js +1 -1
  11. package/dist/components/ChainOfThought.d.ts +1 -11
  12. package/dist/components/ChainOfThought.js +2 -2
  13. package/dist/components/CodeBlock.js +1 -1
  14. package/dist/components/Combobox.d.ts +1 -176
  15. package/dist/components/Commit.d.ts +1 -1
  16. package/dist/components/Commit.js +3 -3
  17. package/dist/components/ContextMenu.js +1 -1
  18. package/dist/components/Conversation.js +11 -8
  19. package/dist/components/Dialog.js +1 -1
  20. package/dist/components/EnvironmentVariables.js +1 -1
  21. package/dist/components/FileTree.js +1 -1
  22. package/dist/components/Menu.d.ts +1 -394
  23. package/dist/components/Menubar.js +1 -1
  24. package/dist/components/Message.js +1 -1
  25. package/dist/components/ModelSelector.js +1 -1
  26. package/dist/components/NavigationMenu.js +1 -1
  27. package/dist/components/PricingPage.js +1 -1
  28. package/dist/components/PromptInput.d.ts +4 -4
  29. package/dist/components/PromptInput.js +2 -2
  30. package/dist/components/Queue.d.ts +1 -1
  31. package/dist/components/Queue.js +2 -2
  32. package/dist/components/Reasoning.js +2 -2
  33. package/dist/components/Select.js +1 -1
  34. package/dist/components/Sources.js +2 -2
  35. package/dist/components/Stepper.js +1 -1
  36. package/dist/components/Tabs.d.ts +1 -83
  37. package/dist/components/Task.js +2 -2
  38. package/dist/components/Terminal.js +2 -2
  39. package/dist/components/TestResults.js +2 -2
  40. package/dist/components/Tool.js +8 -4
  41. package/dist/components/WebPreview.js +1 -1
  42. package/dist/components/icons.d.ts +2 -0
  43. package/dist/components/icons.js +2 -0
  44. package/dist/components/useStickToBottom.js +10 -1
  45. package/dist/{copy-button-BNgclDrO.js → copy-button-DAPlB8Z0.js} +1 -1
  46. package/dist/{icons-BsWc8g4E.js → icons-Bf7JMKk-.js} +41 -1
  47. package/dist/icons-BklFyZbx.d.ts +48 -0
  48. package/dist/styles/accordion.css +34 -17
  49. package/dist/styles/activity.css +386 -0
  50. package/dist/styles/agent-chat.css +21 -0
  51. package/dist/styles/agent-connection.css +20 -3
  52. package/dist/styles/alert-dialog.css +37 -15
  53. package/dist/styles/artifact.css +24 -6
  54. package/dist/styles/autocomplete.css +25 -6
  55. package/dist/styles/badge.css +8 -6
  56. package/dist/styles/browser-live-view.css +164 -0
  57. package/dist/styles/browser-replay.css +189 -0
  58. package/dist/styles/button.css +14 -6
  59. package/dist/styles/card.css +4 -8
  60. package/dist/styles/chain-of-thought.css +5 -12
  61. package/dist/styles/checkbox.css +3 -3
  62. package/dist/styles/code-block.css +4 -8
  63. package/dist/styles/collapsible.css +7 -10
  64. package/dist/styles/combobox.css +6 -6
  65. package/dist/styles/commit.css +2 -9
  66. package/dist/styles/context-menu.css +2 -2
  67. package/dist/styles/conversation.css +12 -5
  68. package/dist/styles/dialog.css +1 -1
  69. package/dist/styles/field.css +2 -2
  70. package/dist/styles/file-tree.css +2 -2
  71. package/dist/styles/index.css +5 -0
  72. package/dist/styles/input.css +8 -3
  73. package/dist/styles/menu.css +4 -4
  74. package/dist/styles/menubar.css +5 -5
  75. package/dist/styles/message.css +3 -4
  76. package/dist/styles/navigation-menu.css +6 -6
  77. package/dist/styles/number-field.css +4 -4
  78. package/dist/styles/popover.css +7 -7
  79. package/dist/styles/preview-card.css +2 -2
  80. package/dist/styles/pricing-page.css +2 -2
  81. package/dist/styles/prompt-input.css +11 -9
  82. package/dist/styles/queue.css +6 -15
  83. package/dist/styles/radio.css +5 -5
  84. package/dist/styles/reasoning.css +6 -10
  85. package/dist/styles/scroll-area.css +2 -2
  86. package/dist/styles/select.css +3 -3
  87. package/dist/styles/slider.css +2 -2
  88. package/dist/styles/sources.css +5 -12
  89. package/dist/styles/stepper.css +13 -9
  90. package/dist/styles/switch.css +4 -4
  91. package/dist/styles/tabs.css +3 -3
  92. package/dist/styles/task.css +13 -18
  93. package/dist/styles/terminal.css +1 -3
  94. package/dist/styles/test-results.css +2 -9
  95. package/dist/styles/toast.css +3 -3
  96. package/dist/styles/toggle-group.css +3 -3
  97. package/dist/styles/toggle.css +3 -3
  98. package/dist/styles/tool.css +22 -21
  99. package/dist/styles/toolbar.css +4 -4
  100. package/dist/styles/workspace-explorer.css +108 -0
  101. package/package.json +10 -3
@@ -0,0 +1,148 @@
1
+ import { CollapsiblePanelProps, CollapsibleRootProps, CollapsibleTriggerProps } from "./Collapsible.js";
2
+ import * as React from "react";
3
+
4
+ //#region src/components/Activity.d.ts
5
+ interface ActivityProps extends Omit<CollapsibleRootProps, "className" | "unstyled"> {
6
+ className?: string;
7
+ /** While true, the trigger label shimmers. */
8
+ isStreaming?: boolean;
9
+ }
10
+ /**
11
+ * A collapsible activity line that aggregates agent activity (tool calls,
12
+ * file edits, searches) instead of rendering every call as its own block.
13
+ * Borderless, Claude/Codex style: the collapsed state is a single plain text
14
+ * line whose label shimmers while streaming — pass the latest action as the
15
+ * label while streaming, and a short summary once settled. Expanding reveals
16
+ * the full log. Compose with ActivityTrigger, ActivityContent, and
17
+ * ActivityItem.
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * <Activity isStreaming={running}>
22
+ * <ActivityTrigger label={running ? "Searching code" : "Read 2 files and searched code"} />
23
+ * <ActivityContent>
24
+ * <ActivityItem>Searched code</ActivityItem>
25
+ * <ActivityItem>Edited a file</ActivityItem>
26
+ * </ActivityContent>
27
+ * </Activity>
28
+ * ```
29
+ */
30
+ declare function Activity({
31
+ className,
32
+ isStreaming,
33
+ defaultOpen,
34
+ ref,
35
+ ...props
36
+ }: ActivityProps & {
37
+ ref?: React.Ref<HTMLDivElement>;
38
+ }): React.JSX.Element;
39
+ interface ActivityTriggerProps extends Omit<CollapsibleTriggerProps, "className" | "unstyled"> {
40
+ className?: string;
41
+ /** Header text. Defaults to "Working…". */
42
+ label?: React.ReactNode;
43
+ }
44
+ /**
45
+ * Clickable header line that toggles the activity log. The label shimmers
46
+ * while the parent Activity is streaming.
47
+ */
48
+ declare function ActivityTrigger({
49
+ className,
50
+ label,
51
+ children,
52
+ ref,
53
+ ...props
54
+ }: ActivityTriggerProps & {
55
+ ref?: React.Ref<HTMLButtonElement>;
56
+ }): React.JSX.Element;
57
+ interface ActivityContentProps extends Omit<CollapsiblePanelProps, "className" | "unstyled"> {
58
+ className?: string;
59
+ }
60
+ /** The collapsible log of ActivityItem children. */
61
+ declare function ActivityContent({
62
+ className,
63
+ children,
64
+ ref,
65
+ ...props
66
+ }: ActivityContentProps & {
67
+ ref?: React.Ref<HTMLDivElement>;
68
+ }): React.JSX.Element;
69
+ interface ActivityItemGroupProps extends Omit<CollapsibleRootProps, "className" | "unstyled"> {
70
+ className?: string;
71
+ /** The row text, e.g. "Ran bash · vp test". */
72
+ label: React.ReactNode;
73
+ /** Optional leading icon for the row. */
74
+ icon?: React.ReactNode;
75
+ }
76
+ /**
77
+ * An expandable activity row — the second collapse level. The trigger reads
78
+ * like a plain ActivityItem; expanding reveals chrome-free detail (a Terminal,
79
+ * a thought trace) flush inside the outer Activity log.
80
+ */
81
+ declare function ActivityItemGroup({
82
+ className,
83
+ label,
84
+ icon,
85
+ children,
86
+ ref,
87
+ ...props
88
+ }: ActivityItemGroupProps & {
89
+ ref?: React.Ref<HTMLDivElement>;
90
+ }): React.JSX.Element;
91
+ interface ActivityTextProps extends React.HTMLAttributes<HTMLDivElement> {}
92
+ /** Scrollable plain-text detail inside an ActivityItemGroup. */
93
+ declare function ActivityText({
94
+ className,
95
+ children,
96
+ ref,
97
+ ...props
98
+ }: ActivityTextProps & {
99
+ ref?: React.Ref<HTMLDivElement>;
100
+ }): React.JSX.Element;
101
+ interface ActivityItemProps extends React.HTMLAttributes<HTMLDivElement> {
102
+ /** Optional leading icon for the row. */
103
+ icon?: React.ReactNode;
104
+ }
105
+ /**
106
+ * A single activity row — "Searched code", "Edited a file", etc. Free-form
107
+ * content; keep it to one line so the streaming peek reads well.
108
+ */
109
+ declare function ActivityItem({
110
+ className,
111
+ icon,
112
+ children,
113
+ ref,
114
+ ...props
115
+ }: ActivityItemProps & {
116
+ ref?: React.Ref<HTMLDivElement>;
117
+ }): React.JSX.Element;
118
+ interface ActivityOutputProps extends React.HTMLAttributes<HTMLPreElement> {}
119
+ /** Scrollable monospaced output inside an ActivityPanel. */
120
+ declare function ActivityOutput({
121
+ className,
122
+ children,
123
+ ref,
124
+ ...props
125
+ }: ActivityOutputProps & {
126
+ ref?: React.Ref<HTMLPreElement>;
127
+ }): React.JSX.Element;
128
+ interface ActivityPanelProps extends React.HTMLAttributes<HTMLDivElement> {
129
+ label: React.ReactNode;
130
+ text?: string;
131
+ status?: React.ReactNode;
132
+ error?: boolean;
133
+ }
134
+ /** Quiet detail panel for tool output inside an ActivityItemGroup. */
135
+ declare function ActivityPanel({
136
+ className,
137
+ label,
138
+ text,
139
+ status,
140
+ error,
141
+ children,
142
+ ref,
143
+ ...props
144
+ }: ActivityPanelProps & {
145
+ ref?: React.Ref<HTMLDivElement>;
146
+ }): React.JSX.Element;
147
+ //#endregion
148
+ export { Activity, ActivityContent, ActivityContentProps, ActivityItem, ActivityItemGroup, ActivityItemGroupProps, ActivityItemProps, ActivityOutput, ActivityOutputProps, ActivityPanel, ActivityPanelProps, ActivityProps, ActivityText, ActivityTextProps, ActivityTrigger, ActivityTriggerProps };
@@ -0,0 +1,177 @@
1
+ import { CollapsiblePanel, CollapsibleRoot, CollapsibleTrigger } from "./Collapsible.js";
2
+ import { t as cx } from "../class-names-9UtZwb0J.js";
3
+ import { l as ChevronRightIcon } from "../icons-Bf7JMKk-.js";
4
+ import "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region src/components/Activity.tsx
7
+ /**
8
+ * A collapsible activity line that aggregates agent activity (tool calls,
9
+ * file edits, searches) instead of rendering every call as its own block.
10
+ * Borderless, Claude/Codex style: the collapsed state is a single plain text
11
+ * line whose label shimmers while streaming — pass the latest action as the
12
+ * label while streaming, and a short summary once settled. Expanding reveals
13
+ * the full log. Compose with ActivityTrigger, ActivityContent, and
14
+ * ActivityItem.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * <Activity isStreaming={running}>
19
+ * <ActivityTrigger label={running ? "Searching code" : "Read 2 files and searched code"} />
20
+ * <ActivityContent>
21
+ * <ActivityItem>Searched code</ActivityItem>
22
+ * <ActivityItem>Edited a file</ActivityItem>
23
+ * </ActivityContent>
24
+ * </Activity>
25
+ * ```
26
+ */
27
+ function Activity({ className, isStreaming = false, defaultOpen = false, ref, ...props }) {
28
+ return /* @__PURE__ */ jsx(CollapsibleRoot, {
29
+ ref,
30
+ className: cx("activity", className),
31
+ defaultOpen,
32
+ "data-streaming": isStreaming || void 0,
33
+ ...props,
34
+ unstyled: true
35
+ });
36
+ }
37
+ /**
38
+ * Clickable header line that toggles the activity log. The label shimmers
39
+ * while the parent Activity is streaming.
40
+ */
41
+ function ActivityTrigger({ className, label = "Working…", children, ref, ...props }) {
42
+ if (children !== void 0 && children !== null) return /* @__PURE__ */ jsx(CollapsibleTrigger, {
43
+ ref,
44
+ className: cx("activity__trigger", className),
45
+ ...props,
46
+ unstyled: true,
47
+ children
48
+ });
49
+ return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
50
+ ref,
51
+ className: cx("activity__trigger", className),
52
+ ...props,
53
+ unstyled: true,
54
+ children: [/* @__PURE__ */ jsx("span", {
55
+ className: "activity__trigger-label",
56
+ children: label
57
+ }), /* @__PURE__ */ jsx("span", {
58
+ className: "activity__trigger-icon",
59
+ "aria-hidden": "true",
60
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
61
+ })]
62
+ });
63
+ }
64
+ /** The collapsible log of ActivityItem children. */
65
+ function ActivityContent({ className, children, ref, ...props }) {
66
+ return /* @__PURE__ */ jsx(CollapsiblePanel, {
67
+ ref,
68
+ className: cx("activity__content", className),
69
+ ...props,
70
+ unstyled: true,
71
+ children: /* @__PURE__ */ jsx("div", {
72
+ className: "activity__list",
73
+ children
74
+ })
75
+ });
76
+ }
77
+ /**
78
+ * An expandable activity row — the second collapse level. The trigger reads
79
+ * like a plain ActivityItem; expanding reveals chrome-free detail (a Terminal,
80
+ * a thought trace) flush inside the outer Activity log.
81
+ */
82
+ function ActivityItemGroup({ className, label, icon, children, ref, ...props }) {
83
+ return /* @__PURE__ */ jsxs(CollapsibleRoot, {
84
+ ref,
85
+ className: cx("activity__group", className),
86
+ ...props,
87
+ unstyled: true,
88
+ children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
89
+ className: "activity__group-trigger",
90
+ unstyled: true,
91
+ children: [
92
+ icon ? /* @__PURE__ */ jsx("span", {
93
+ className: "activity__item-icon",
94
+ "aria-hidden": "true",
95
+ children: icon
96
+ }) : null,
97
+ /* @__PURE__ */ jsx("span", {
98
+ className: "activity__item-text",
99
+ children: label
100
+ }),
101
+ /* @__PURE__ */ jsx("span", {
102
+ className: "activity__group-icon",
103
+ "aria-hidden": "true",
104
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
105
+ })
106
+ ]
107
+ }), /* @__PURE__ */ jsx(CollapsiblePanel, {
108
+ className: "activity__group-panel",
109
+ unstyled: true,
110
+ children: /* @__PURE__ */ jsx("div", {
111
+ className: "activity__group-panel-inner",
112
+ children
113
+ })
114
+ })]
115
+ });
116
+ }
117
+ /** Scrollable plain-text detail inside an ActivityItemGroup. */
118
+ function ActivityText({ className, children, ref, ...props }) {
119
+ return /* @__PURE__ */ jsx("div", {
120
+ ref,
121
+ tabIndex: 0,
122
+ className: cx("activity__group-text", className),
123
+ ...props,
124
+ children
125
+ });
126
+ }
127
+ /**
128
+ * A single activity row — "Searched code", "Edited a file", etc. Free-form
129
+ * content; keep it to one line so the streaming peek reads well.
130
+ */
131
+ function ActivityItem({ className, icon, children, ref, ...props }) {
132
+ return /* @__PURE__ */ jsxs("div", {
133
+ ref,
134
+ className: cx("activity__item", className),
135
+ ...props,
136
+ children: [icon ? /* @__PURE__ */ jsx("span", {
137
+ className: "activity__item-icon",
138
+ "aria-hidden": "true",
139
+ children: icon
140
+ }) : null, /* @__PURE__ */ jsx("span", {
141
+ className: "activity__item-text",
142
+ children
143
+ })]
144
+ });
145
+ }
146
+ /** Scrollable monospaced output inside an ActivityPanel. */
147
+ function ActivityOutput({ className, children, ref, ...props }) {
148
+ return /* @__PURE__ */ jsx("pre", {
149
+ ref,
150
+ tabIndex: 0,
151
+ className: cx("activity__shell-output", className),
152
+ ...props,
153
+ children
154
+ });
155
+ }
156
+ /** Quiet detail panel for tool output inside an ActivityItemGroup. */
157
+ function ActivityPanel({ className, label, text, status, error, children, ref, ...props }) {
158
+ return /* @__PURE__ */ jsxs("div", {
159
+ ref,
160
+ className: cx("activity__shell", className),
161
+ ...props,
162
+ children: [
163
+ /* @__PURE__ */ jsx("span", {
164
+ className: "activity__shell-label",
165
+ children: label
166
+ }),
167
+ children ?? (text ? /* @__PURE__ */ jsx(ActivityOutput, { children: text }) : null),
168
+ status ? /* @__PURE__ */ jsx("span", {
169
+ className: "activity__shell-status",
170
+ "data-error": error || void 0,
171
+ children: status
172
+ }) : null
173
+ ]
174
+ });
175
+ }
176
+ //#endregion
177
+ export { Activity, ActivityContent, ActivityItem, ActivityItemGroup, ActivityOutput, ActivityPanel, ActivityText, ActivityTrigger };
@@ -0,0 +1,61 @@
1
+ import { PromptInputMessage, PromptInputStatus } from "./PromptInput.js";
2
+ import * as React from "react";
3
+ import { UIDataTypes, UIMessage, UITools } from "ai";
4
+
5
+ //#region src/components/AgentChat.d.ts
6
+ type AgentChatMessage<Metadata = unknown, DataParts extends UIDataTypes = UIDataTypes, Tools extends UITools = UITools> = UIMessage<Metadata, DataParts, Tools>;
7
+ type AgentChatPart<MessageT extends AgentChatMessage = AgentChatMessage> = MessageT["parts"][number];
8
+ interface AgentChatRenderPartContext<MessageT extends AgentChatMessage = AgentChatMessage> {
9
+ message: MessageT;
10
+ part: AgentChatPart<MessageT>;
11
+ partIndex: number;
12
+ defaultRender: () => React.ReactNode;
13
+ }
14
+ interface AgentChatRenderMessageContext<MessageT extends AgentChatMessage = AgentChatMessage> {
15
+ message: MessageT;
16
+ messageIndex: number;
17
+ }
18
+ interface AgentChatProps<MessageT extends AgentChatMessage = AgentChatMessage> {
19
+ className?: string;
20
+ /** AI SDK `UIMessage`s to render, oldest first. */
21
+ messages: readonly MessageT[];
22
+ /** Drives the composer's send/stop affordance and streaming indicators. */
23
+ status?: PromptInputStatus;
24
+ /** Called with the composed message when the user submits. Omit for a read-only transcript. */
25
+ onSubmit?: (message: PromptInputMessage) => void | Promise<void>;
26
+ /** Called when the user hits stop while `status` is streaming/submitted. */
27
+ onStop?: () => void;
28
+ placeholder?: string;
29
+ disabled?: boolean;
30
+ /** Rendered in place of the transcript while `messages` is empty. */
31
+ emptyState?: React.ReactNode;
32
+ /** Extra controls rendered in the composer toolbar. */
33
+ composerTools?: React.ReactNode;
34
+ /** Override rendering per part; return `undefined` to fall back to the default part UI. */
35
+ renderPart?: (context: AgentChatRenderPartContext<MessageT>) => React.ReactNode | undefined;
36
+ /** Rendered after each message's parts — for actions, citations, and the like. */
37
+ renderMessageAfter?: (context: AgentChatRenderMessageContext<MessageT>) => React.ReactNode;
38
+ }
39
+ /**
40
+ * A complete agent chat surface: auto-scrolling conversation of AI SDK
41
+ * `UIMessage`s (text, reasoning, and tool parts rendered by default) plus a
42
+ * prompt composer. Customize per-part rendering with `renderPart`.
43
+ */
44
+ declare function AgentChat<MessageT extends AgentChatMessage = AgentChatMessage>({
45
+ className,
46
+ messages,
47
+ status,
48
+ onSubmit,
49
+ onStop,
50
+ placeholder,
51
+ disabled,
52
+ emptyState,
53
+ composerTools,
54
+ renderPart,
55
+ renderMessageAfter,
56
+ ref
57
+ }: AgentChatProps<MessageT> & {
58
+ ref?: React.Ref<HTMLDivElement>;
59
+ }): React.JSX.Element;
60
+ //#endregion
61
+ export { AgentChat, AgentChatMessage, AgentChatPart, AgentChatProps, AgentChatRenderMessageContext, AgentChatRenderPartContext };
@@ -0,0 +1,91 @@
1
+ import { t as cx } from "../class-names-9UtZwb0J.js";
2
+ import { Conversation, ConversationContent, ConversationEmptyState, ConversationScrollButton } from "./Conversation.js";
3
+ import { Message, MessageContent, MessageResponse } from "./Message.js";
4
+ import { PromptInput, PromptInputBody, PromptInputFooter, PromptInputSubmit, PromptInputTextarea, PromptInputTools } from "./PromptInput.js";
5
+ import { Reasoning, ReasoningContent, ReasoningTrigger } from "./Reasoning.js";
6
+ import { Tool, ToolContent, ToolHeader, ToolInput, ToolOutput } from "./Tool.js";
7
+ import * as React from "react";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { getToolName, isReasoningUIPart, isTextUIPart, isToolUIPart } from "ai";
10
+ //#region src/components/AgentChat.tsx
11
+ function getPartKey(part, partIndex) {
12
+ if (isToolUIPart(part)) return part.toolCallId;
13
+ if ("id" in part && typeof part.id === "string") return `${part.type}-${part.id}`;
14
+ return `${part.type}-${partIndex}`;
15
+ }
16
+ function renderDefaultPart(part) {
17
+ if (isTextUIPart(part) && part.text) return /* @__PURE__ */ jsx(MessageResponse, { children: part.text });
18
+ if (isReasoningUIPart(part) && part.text) return /* @__PURE__ */ jsxs(Reasoning, {
19
+ isStreaming: part.state === "streaming",
20
+ children: [/* @__PURE__ */ jsx(ReasoningTrigger, {}), /* @__PURE__ */ jsx(ReasoningContent, { children: part.text })]
21
+ });
22
+ if (isToolUIPart(part)) {
23
+ const output = "output" in part ? part.output : void 0;
24
+ const errorText = "errorText" in part ? part.errorText : void 0;
25
+ const toolType = part.type === "dynamic-tool" ? "dynamic-tool" : "function";
26
+ return /* @__PURE__ */ jsxs(Tool, {
27
+ state: part.state,
28
+ children: [/* @__PURE__ */ jsx(ToolHeader, {
29
+ type: toolType,
30
+ toolName: getToolName(part),
31
+ title: part.title
32
+ }), /* @__PURE__ */ jsxs(ToolContent, { children: [part.input !== void 0 ? /* @__PURE__ */ jsx(ToolInput, { input: part.input }) : null, /* @__PURE__ */ jsx(ToolOutput, {
33
+ output,
34
+ errorText
35
+ })] })]
36
+ });
37
+ }
38
+ return null;
39
+ }
40
+ /**
41
+ * A complete agent chat surface: auto-scrolling conversation of AI SDK
42
+ * `UIMessage`s (text, reasoning, and tool parts rendered by default) plus a
43
+ * prompt composer. Customize per-part rendering with `renderPart`.
44
+ */
45
+ function AgentChat({ className, messages, status = "ready", onSubmit, onStop, placeholder = "Ask anything...", disabled, emptyState, composerTools, renderPart, renderMessageAfter, ref }) {
46
+ const handleSubmit = React.useCallback((message) => {
47
+ onSubmit?.(message);
48
+ }, [onSubmit]);
49
+ return /* @__PURE__ */ jsxs("div", {
50
+ ref,
51
+ className: cx("agent-chat", className),
52
+ children: [/* @__PURE__ */ jsxs(Conversation, {
53
+ className: "agent-chat__conversation",
54
+ children: [/* @__PURE__ */ jsxs(ConversationContent, { children: [messages.length === 0 ? emptyState ?? /* @__PURE__ */ jsx(ConversationEmptyState, {
55
+ title: "Start a conversation",
56
+ description: "Ask the agent to inspect, plan, or build."
57
+ }) : null, messages.map((message, messageIndex) => /* @__PURE__ */ jsxs(Message, {
58
+ from: message.role,
59
+ children: [message.parts.map((part, partIndex) => {
60
+ const defaultRender = () => renderDefaultPart(part);
61
+ const custom = renderPart?.({
62
+ message,
63
+ part,
64
+ partIndex,
65
+ defaultRender
66
+ });
67
+ const rendered = custom === void 0 ? defaultRender() : custom;
68
+ return rendered ? /* @__PURE__ */ jsx(MessageContent, { children: rendered }, getPartKey(part, partIndex)) : null;
69
+ }), renderMessageAfter?.({
70
+ message,
71
+ messageIndex
72
+ })]
73
+ }, message.id ?? messageIndex))] }), /* @__PURE__ */ jsx(ConversationScrollButton, {})]
74
+ }), /* @__PURE__ */ jsx("div", {
75
+ className: "agent-chat__composer",
76
+ children: /* @__PURE__ */ jsxs(PromptInput, {
77
+ onSubmit: handleSubmit,
78
+ children: [/* @__PURE__ */ jsx(PromptInputBody, { children: /* @__PURE__ */ jsx(PromptInputTextarea, {
79
+ "aria-label": "Message",
80
+ placeholder,
81
+ disabled
82
+ }) }), /* @__PURE__ */ jsxs(PromptInputFooter, { children: [/* @__PURE__ */ jsx(PromptInputTools, { children: composerTools }), /* @__PURE__ */ jsx(PromptInputSubmit, {
83
+ status,
84
+ onStop
85
+ })] })]
86
+ })
87
+ })]
88
+ });
89
+ }
90
+ //#endregion
91
+ export { AgentChat };
@@ -1,7 +1,7 @@
1
- import { v as LinkIcon } from "../icons-BsWc8g4E.js";
2
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
+ import { b as LinkIcon } from "../icons-Bf7JMKk-.js";
3
3
  import { Button } from "./Button.js";
4
- import { a as CodeBlockCopyButton, i as CodeBlockContent, n as CodeBlockActions, p as CodeBlockTitle, r as CodeBlockContainer, s as CodeBlockHeader, t as CodeBlock } from "../CodeBlock-CttHhWcb.js";
4
+ import { a as CodeBlockCopyButton, i as CodeBlockContent, n as CodeBlockActions, p as CodeBlockTitle, r as CodeBlockContainer, s as CodeBlockHeader, t as CodeBlock } from "../CodeBlock-BrCoypnc.js";
5
5
  import { Popover } from "./Popover.js";
6
6
  import * as React from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,5 +1,5 @@
1
- import { O as XIcon } from "../icons-BsWc8g4E.js";
2
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
+ import { P as XIcon } from "../icons-Bf7JMKk-.js";
3
3
  import { Button } from "./Button.js";
4
4
  import { Tooltip, TooltipPopup, TooltipPortal, TooltipPositioner, TooltipTrigger } from "./Tooltip.js";
5
5
  import "react";
@@ -1,17 +1,7 @@
1
1
  import { CollapsiblePanelProps, CollapsibleRootProps, CollapsibleTriggerProps } from "./Collapsible.js";
2
+ import { v as IconProps } from "../icons-BklFyZbx.js";
2
3
  import * as React from "react";
3
4
 
4
- //#region src/components/_internal/icons.d.ts
5
- /**
6
- * Small inline-SVG icon set used across AI chat and code components.
7
- *
8
- * All icons are 16x16 by default, use `currentColor` for strokes/fills, and
9
- * accept standard SVG props so consumers can override size and aria-hidden.
10
- */
11
- type IconProps = Omit<React.SVGAttributes<SVGSVGElement>, "width" | "height"> & {
12
- size?: number | string;
13
- };
14
- //#endregion
15
5
  //#region src/components/ChainOfThought.d.ts
16
6
  interface ChainOfThoughtProps extends Omit<CollapsibleRootProps, "className" | "unstyled"> {
17
7
  className?: string;
@@ -1,6 +1,6 @@
1
- import { C as SpinnerIcon, c as ChevronRightIcon, o as CheckIcon, u as DotIcon } from "../icons-BsWc8g4E.js";
2
- import { t as cx } from "../class-names-9UtZwb0J.js";
3
1
  import { CollapsiblePanel, CollapsibleRoot, CollapsibleTrigger } from "./Collapsible.js";
2
+ import { t as cx } from "../class-names-9UtZwb0J.js";
3
+ import { d as DotIcon, k as SpinnerIcon, l as ChevronRightIcon, o as CheckIcon } from "../icons-Bf7JMKk-.js";
4
4
  import "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region src/components/ChainOfThought.tsx
@@ -1,2 +1,2 @@
1
- import { a as CodeBlockCopyButton, c as CodeBlockLanguageSelector, d as CodeBlockLanguageSelectorTrigger, f as CodeBlockLanguageSelectorValue, h as CODE_BLOCK_LANGUAGES, i as CodeBlockContent, l as CodeBlockLanguageSelectorContent, m as highlightCode, n as CodeBlockActions, o as CodeBlockFilename, p as CodeBlockTitle, r as CodeBlockContainer, s as CodeBlockHeader, t as CodeBlock, u as CodeBlockLanguageSelectorItem } from "../CodeBlock-CttHhWcb.js";
1
+ import { a as CodeBlockCopyButton, c as CodeBlockLanguageSelector, d as CodeBlockLanguageSelectorTrigger, f as CodeBlockLanguageSelectorValue, h as CODE_BLOCK_LANGUAGES, i as CodeBlockContent, l as CodeBlockLanguageSelectorContent, m as highlightCode, n as CodeBlockActions, o as CodeBlockFilename, p as CodeBlockTitle, r as CodeBlockContainer, s as CodeBlockHeader, t as CodeBlock, u as CodeBlockLanguageSelectorItem } from "../CodeBlock-BrCoypnc.js";
2
2
  export { CODE_BLOCK_LANGUAGES, CodeBlock, CodeBlockActions, CodeBlockContainer, CodeBlockContent, CodeBlockCopyButton, CodeBlockFilename, CodeBlockHeader, CodeBlockLanguageSelector, CodeBlockLanguageSelectorContent, CodeBlockLanguageSelectorItem, CodeBlockLanguageSelectorTrigger, CodeBlockLanguageSelectorValue, CodeBlockTitle, highlightCode };