@mcp-b/react-components 0.37.0 → 0.38.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 (38) hide show
  1. package/dist/{AgentActivity-SP1WfLDW.d.ts → AgentActivity-Cc_oDYum.d.ts} +1 -1
  2. package/dist/Message-DBsHHhcM.d.ts +228 -0
  3. package/dist/{ThinkChat-DQh59CeC.js → ThinkChat-DkA4Wr71.js} +8 -3
  4. package/dist/{ThinkChatActivity-Dkmm2pIj.d.ts → ThinkChatActivity-D6-_5Phw.d.ts} +1 -1
  5. package/dist/{ThinkChatActivitySummary-teRjrPxW.d.ts → ThinkChatActivitySummary-BtBQgMg6.d.ts} +1 -1
  6. package/dist/{WorkspaceFileView-Cu_ZG6HJ.js → WorkspaceFileView-DeGzWwhK.js} +2 -2
  7. package/dist/{WorkspaceLink-DQogVe8E.d.ts → WorkspaceLink-Bh9-Jo1r.d.ts} +1 -1
  8. package/dist/{WorkspaceLink-DZeLe_jN.js → WorkspaceLink-DtH66bAY.js} +4 -3
  9. package/dist/{WorkspaceMessageResponse-BWbkIELl.js → WorkspaceMessageResponse-CJCmGvTx.js} +64 -7
  10. package/dist/WorkspaceMessageResponse-Cy28WGSz.d.ts +24 -0
  11. package/dist/components/agents-sdk/AgentActivity.d.ts +1 -1
  12. package/dist/components/agents-sdk/AgentActivityPreview.d.ts +2 -2
  13. package/dist/components/agents-sdk/AgentActivityPreview.js +1 -1
  14. package/dist/components/agents-sdk/ThinkChat.d.ts +5 -2
  15. package/dist/components/agents-sdk/ThinkChat.js +1 -1
  16. package/dist/components/agents-sdk/ThinkChatActivity.d.ts +1 -1
  17. package/dist/components/agents-sdk/ThinkChatActivitySummary.d.ts +1 -1
  18. package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +1 -1
  19. package/dist/components/agents-sdk/ThinkFullApp.d.ts +1 -1
  20. package/dist/components/agents-sdk/ThinkFullApp.js +2 -2
  21. package/dist/components/agents-sdk/ThinkRoutineBrowser.js +1 -1
  22. package/dist/components/agents-sdk/ThinkRoutineForm.js +1 -1
  23. package/dist/components/agents-sdk/ThinkRoutineLibrary.js +1 -1
  24. package/dist/components/agents-sdk/ThinkRoutineRuns.js +1 -1
  25. package/dist/components/agents-sdk/ThinkThreadPicker.js +1 -1
  26. package/dist/components/agents-sdk/WorkspaceExplorer.d.ts +1 -1
  27. package/dist/components/agents-sdk/WorkspaceExplorer.js +2 -2
  28. package/dist/components/agents-sdk/WorkspaceFileView.js +1 -1
  29. package/dist/components/agents-sdk/WorkspaceLink.d.ts +1 -1
  30. package/dist/components/agents-sdk/WorkspaceLink.js +1 -1
  31. package/dist/components/agents-sdk/WorkspaceMessageResponse.d.ts +2 -12
  32. package/dist/components/agents-sdk/WorkspaceMessageResponse.js +1 -1
  33. package/dist/components/ai-sdk/Artifact.d.ts +44 -1
  34. package/dist/components/ai-sdk/Artifact.js +79 -3
  35. package/dist/components/ai-sdk/Message.d.ts +1 -227
  36. package/dist/components/nanites/AgentToolDetail.js +1 -1
  37. package/dist/styles/artifact.css +65 -0
  38. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import { n as WorkspaceDestination } from "./WorkspaceLink-DQogVe8E.js";
1
+ import { n as WorkspaceDestination } from "./WorkspaceLink-Bh9-Jo1r.js";
2
2
  import * as React from "react";
3
3
 
4
4
  //#region src/components/agents-sdk/AgentActivity.d.ts
@@ -0,0 +1,228 @@
1
+ import { n as IconButtonProps } from "./IconButton-BAUFhUk8.js";
2
+ import * as React from "react";
3
+ import { FileUIPart, UIMessage } from "ai";
4
+ import { StreamdownProps } from "streamdown";
5
+
6
+ //#region src/components/ai-sdk/Message.d.ts
7
+ type MessageRole = UIMessage["role"];
8
+ interface MessageProps extends React.HTMLAttributes<HTMLDivElement> {
9
+ /**
10
+ * The originating role of the message. Controls alignment and styling via
11
+ * the `data-from` attribute (e.g. user messages align end).
12
+ */
13
+ from?: MessageRole;
14
+ }
15
+ /**
16
+ * A chat message row. Aligns and styles itself based on {@link from}.
17
+ * Adapted from Vercel AI Elements and restyled with Sigvelo CSS tokens.
18
+ *
19
+ * Compose with {@link MessageContent} for the bubble, {@link MessageActions}
20
+ * for toolbar actions, and {@link MessageBranch} for multi-version responses.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * <Message from="assistant">
25
+ * <MessageContent>Hello there!</MessageContent>
26
+ * <MessageActions>
27
+ * <MessageAction label="Copy" tooltip="Copy to clipboard">
28
+ * <CopyIcon />
29
+ * </MessageAction>
30
+ * </MessageActions>
31
+ * </Message>
32
+ * ```
33
+ *
34
+ * @see {@link https://elements.ai-sdk.dev/components/message | AI Elements Message}
35
+ */
36
+ declare function Message({
37
+ className,
38
+ from,
39
+ children,
40
+ ref,
41
+ ...props
42
+ }: MessageProps & {
43
+ ref?: React.Ref<HTMLDivElement>;
44
+ }): React.JSX.Element;
45
+ interface MessageContentProps extends React.HTMLAttributes<HTMLDivElement> {}
46
+ /**
47
+ * The visible bubble/body of a message. Styled differently based on the
48
+ * parent {@link Message}'s `from` attribute.
49
+ */
50
+ declare function MessageContent({
51
+ className,
52
+ children,
53
+ ref,
54
+ ...props
55
+ }: MessageContentProps & {
56
+ ref?: React.Ref<HTMLDivElement>;
57
+ }): React.JSX.Element;
58
+ type MessageResponseProps = StreamdownProps;
59
+ declare const MessageResponse: React.MemoExoticComponent<({
60
+ className,
61
+ components,
62
+ ...props
63
+ }: MessageResponseProps) => React.JSX.Element>;
64
+ interface MessageAttachmentProps extends Omit<React.HTMLAttributes<HTMLElement>, "color" | "part"> {
65
+ /** The AI SDK `file` part, taken whole. */
66
+ part: FileUIPart;
67
+ }
68
+ /**
69
+ * A `file` part inside a message: images render inline (click to zoom),
70
+ * anything else becomes a download chip. Covers both directions — files the
71
+ * user attached and files the agent emitted.
72
+ */
73
+ declare function MessageAttachment({
74
+ part,
75
+ className,
76
+ ...props
77
+ }: MessageAttachmentProps): React.JSX.Element;
78
+ interface MessageActionsProps extends React.HTMLAttributes<HTMLDivElement> {}
79
+ /**
80
+ * Horizontal list of action buttons (copy, retry, thumbs-up, etc.) shown
81
+ * alongside or beneath a message.
82
+ */
83
+ declare function MessageActions({
84
+ className,
85
+ children,
86
+ ref,
87
+ ...props
88
+ }: MessageActionsProps & {
89
+ ref?: React.Ref<HTMLDivElement>;
90
+ }): React.JSX.Element;
91
+ interface MessageActionProps extends Omit<IconButtonProps, "children"> {
92
+ children?: React.ReactNode;
93
+ }
94
+ /**
95
+ * A single icon button inside {@link MessageActions}. Always has an accessible
96
+ * name; shows a tooltip on hover/focus when {@link tooltip} is set.
97
+ */
98
+ declare function MessageAction({
99
+ className,
100
+ label,
101
+ tooltip,
102
+ variant,
103
+ color,
104
+ size,
105
+ children,
106
+ ref,
107
+ ...props
108
+ }: MessageActionProps & {
109
+ ref?: React.Ref<HTMLButtonElement>;
110
+ }): React.JSX.Element;
111
+ interface MessageToolbarProps extends React.HTMLAttributes<HTMLDivElement> {}
112
+ /**
113
+ * Horizontal container that places children in a row with space between —
114
+ * typically a {@link MessageBranchSelector} on one side and
115
+ * {@link MessageActions} on the other.
116
+ */
117
+ declare function MessageToolbar({
118
+ className,
119
+ children,
120
+ ref,
121
+ ...props
122
+ }: MessageToolbarProps & {
123
+ ref?: React.Ref<HTMLDivElement>;
124
+ }): React.JSX.Element;
125
+ interface MessageBranchProps extends React.HTMLAttributes<HTMLDivElement> {
126
+ /** Number of response branches rendered by MessageBranchContent. */
127
+ branchCount: number;
128
+ /** Zero-based index of the initially selected branch. */
129
+ defaultBranch?: number;
130
+ /** Controlled branch index. */
131
+ branch?: number;
132
+ /** Called when the selected branch changes. */
133
+ onBranchChange?: (branchIndex: number) => void;
134
+ }
135
+ /**
136
+ * Container for a message response with multiple versions. Tracks which
137
+ * branch is active and exposes navigation through {@link MessageBranchSelector},
138
+ * {@link MessageBranchPrevious}, {@link MessageBranchNext}, and {@link MessageBranchPage}.
139
+ */
140
+ declare function MessageBranch({
141
+ className,
142
+ branchCount,
143
+ defaultBranch,
144
+ branch,
145
+ onBranchChange,
146
+ children,
147
+ ref,
148
+ ...props
149
+ }: MessageBranchProps & {
150
+ ref?: React.Ref<HTMLDivElement>;
151
+ }): React.JSX.Element;
152
+ interface MessageBranchContentProps extends React.HTMLAttributes<HTMLDivElement> {}
153
+ /**
154
+ * Renders only the active branch's child. Expects siblings to represent
155
+ * alternative versions of the same response.
156
+ */
157
+ declare function MessageBranchContent({
158
+ className,
159
+ children,
160
+ ref,
161
+ ...props
162
+ }: MessageBranchContentProps & {
163
+ ref?: React.Ref<HTMLDivElement>;
164
+ }): React.JSX.Element;
165
+ interface MessageBranchSelectorProps extends React.HTMLAttributes<HTMLDivElement> {}
166
+ /**
167
+ * Inline group containing branch navigation controls (previous / page /
168
+ * next). Hidden automatically when there is only one branch.
169
+ */
170
+ declare function MessageBranchSelector({
171
+ className,
172
+ children,
173
+ ref,
174
+ ...props
175
+ }: MessageBranchSelectorProps & {
176
+ ref?: React.Ref<HTMLDivElement>;
177
+ }): React.JSX.Element | null;
178
+ interface MessageBranchPreviousProps extends Omit<IconButtonProps, "children" | "label"> {
179
+ label?: string;
180
+ children?: React.ReactNode;
181
+ }
182
+ /** Button that selects the previous branch. Disabled at the first branch. */
183
+ declare function MessageBranchPrevious({
184
+ className,
185
+ label,
186
+ variant,
187
+ color,
188
+ size,
189
+ children,
190
+ onClick,
191
+ ref,
192
+ ...props
193
+ }: MessageBranchPreviousProps & {
194
+ ref?: React.Ref<HTMLButtonElement>;
195
+ }): React.JSX.Element;
196
+ interface MessageBranchNextProps extends Omit<IconButtonProps, "children" | "label"> {
197
+ label?: string;
198
+ children?: React.ReactNode;
199
+ }
200
+ /** Button that selects the next branch. Disabled at the last branch. */
201
+ declare function MessageBranchNext({
202
+ className,
203
+ label,
204
+ variant,
205
+ color,
206
+ size,
207
+ children,
208
+ onClick,
209
+ ref,
210
+ ...props
211
+ }: MessageBranchNextProps & {
212
+ ref?: React.Ref<HTMLButtonElement>;
213
+ }): React.JSX.Element;
214
+ interface MessageBranchPageProps extends React.HTMLAttributes<HTMLSpanElement> {
215
+ /** Customize the displayed text. Defaults to `{index} / {count}`. */
216
+ format?: (currentIndex: number, total: number) => React.ReactNode;
217
+ }
218
+ /** Page indicator (e.g. "1 / 3") for the current branch selection. */
219
+ declare function MessageBranchPage({
220
+ className,
221
+ format,
222
+ ref,
223
+ ...props
224
+ }: MessageBranchPageProps & {
225
+ ref?: React.Ref<HTMLSpanElement>;
226
+ }): React.JSX.Element;
227
+ //#endregion
228
+ export { MessageResponse as C, MessageToolbarProps as D, MessageToolbar as E, MessageProps as S, MessageRole as T, MessageBranchProps as _, MessageActionsProps as a, MessageContent as b, MessageBranch as c, MessageBranchNext as d, MessageBranchNextProps as f, MessageBranchPreviousProps as g, MessageBranchPrevious as h, MessageActions as i, MessageBranchContent as l, MessageBranchPageProps as m, MessageAction as n, MessageAttachment as o, MessageBranchPage as p, MessageActionProps as r, MessageAttachmentProps as s, Message as t, MessageBranchContentProps as u, MessageBranchSelector as v, MessageResponseProps as w, MessageContentProps as x, MessageBranchSelectorProps as y };
@@ -5,7 +5,7 @@ import { SubagentRunList } from "./components/agents-sdk/SubagentRunList.js";
5
5
  import { ThinkChatContext, ThinkChatLiveContext, useOptionalThinkChatContext, useThinkChatContext } from "./components/agents-sdk/ThinkChatContext.js";
6
6
  import { ThinkChatActivity, createThinkChatActivityRenderer, renderThinkChatActivityPart } from "./components/agents-sdk/ThinkChatActivity.js";
7
7
  import { ThinkRecoveryNotice } from "./components/agents-sdk/ThinkRecoveryNotice.js";
8
- import { t as WorkspaceMessageResponse } from "./WorkspaceMessageResponse-BWbkIELl.js";
8
+ import { t as WorkspaceMessageResponse } from "./WorkspaceMessageResponse-CJCmGvTx.js";
9
9
  import * as React from "react";
10
10
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
11
  import { isTextUIPart } from "ai";
@@ -195,7 +195,7 @@ const ThinkChatApprovalsContext = React.createContext(null);
195
195
  * inside the log) or `excludeTools` + your own `renderPart` (standalone
196
196
  * card) — see README "App-specific tools" and the Custom Tool Panel story.
197
197
  */
198
- function ThinkChatMessages({ composerHeader, draft, loading, renderPart, excludeTools, renderAgentToolRunLink, toolRenderers, thinkStub, onExecutionSettled, pendingApprovals, notice, sessionCompaction, ...props }) {
198
+ function ThinkChatMessages({ composerHeader, draft, loading, renderPart, excludeTools, renderAgentToolRunLink, renderWorkspaceHtmlArtifact, toolRenderers, thinkStub, onExecutionSettled, pendingApprovals, notice, sessionCompaction, ...props }) {
199
199
  const chat = useOptionalThinkChatContext();
200
200
  const agentTools = useOptionalAgentToolRuns();
201
201
  const approvals = React.useContext(ThinkChatApprovalsContext);
@@ -224,9 +224,14 @@ function ThinkChatMessages({ composerHeader, draft, loading, renderPart, exclude
224
224
  return isTextUIPart(context.part) && context.part.text ? /* @__PURE__ */ jsx(WorkspaceMessageResponse, {
225
225
  animated: STREAMED_TEXT_ANIMATION,
226
226
  isAnimating: context.message.role === "assistant" && context.message.id === streamingMessageId && context.part.state === "streaming",
227
+ renderWorkspaceHtmlArtifact: context.message.role === "assistant" ? renderWorkspaceHtmlArtifact : void 0,
227
228
  children: context.part.text
228
229
  }) : void 0;
229
- }, [activityRenderPart, streamingMessageId]);
230
+ }, [
231
+ activityRenderPart,
232
+ renderWorkspaceHtmlArtifact,
233
+ streamingMessageId
234
+ ]);
230
235
  const resolvedRenderPart = React.useMemo(() => renderPart ? (context) => {
231
236
  const renderBuiltIn = () => {
232
237
  const builtIn = defaultRenderPart(context);
@@ -1,7 +1,7 @@
1
1
  import { i as AgentMessageRenderPartContext } from "./AgentMessageParts-C7L-Mv9U.js";
2
2
  import { r as AgentChatProps } from "./AgentChat-CVO7xyLC.js";
3
3
  import { l as ThinkChatPart } from "./ThinkChatToolParts-D4qcnnxt.js";
4
- import { t as ThinkChatActivityDescription } from "./ThinkChatActivitySummary-teRjrPxW.js";
4
+ import { t as ThinkChatActivityDescription } from "./ThinkChatActivitySummary-BtBQgMg6.js";
5
5
  import * as React from "react";
6
6
  import { DynamicToolUIPart, ToolUIPart, UIMessage } from "ai";
7
7
  import { AgentToolRunState } from "agents/agent-tools";
@@ -1,4 +1,4 @@
1
- import { i as AgentActivityIconKind, s as AgentActivitySummary } from "./AgentActivity-SP1WfLDW.js";
1
+ import { i as AgentActivityIconKind, s as AgentActivitySummary } from "./AgentActivity-Cc_oDYum.js";
2
2
  import { l as ThinkChatPart } from "./ThinkChatToolParts-D4qcnnxt.js";
3
3
  import { DynamicToolUIPart, ToolUIPart } from "ai";
4
4
 
@@ -3,8 +3,8 @@ import { r as formatClock } from "./format-DB2mX9DA.js";
3
3
  import { a as CodeBlockCopyButton, i as CodeBlockContent, r as CodeBlockContainer, t as CodeBlock } from "./CodeBlock-DO4Hdu1R.js";
4
4
  import { AppTopBar } from "./components/general-purpose/AppTopBar.js";
5
5
  import { inferWorkspaceLanguage, inferWorkspaceMedia, isWorkspaceMarkdownPath, isWorkspaceSkillPath, parseWorkspaceSkill } from "./components/agents-sdk/WorkspaceFile.js";
6
- import { c as useWorkspaceNavigationContext, s as useWorkspaceNavigationRestoration } from "./WorkspaceLink-DZeLe_jN.js";
7
- import { n as createWorkspaceRehypePlugins, t as WorkspaceMessageResponse } from "./WorkspaceMessageResponse-BWbkIELl.js";
6
+ import { c as useWorkspaceNavigationContext, s as useWorkspaceNavigationRestoration } from "./WorkspaceLink-DtH66bAY.js";
7
+ import { n as createWorkspaceRehypePlugins, t as WorkspaceMessageResponse } from "./WorkspaceMessageResponse-CJCmGvTx.js";
8
8
  import { WorkspaceHeader } from "./components/agents-sdk/WorkspaceHeader.js";
9
9
  import * as React from "react";
10
10
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -76,7 +76,7 @@ declare function WorkspaceFileLink({
76
76
  className,
77
77
  download,
78
78
  href,
79
- node: _node,
79
+ node,
80
80
  onClick,
81
81
  rel,
82
82
  target,
@@ -233,11 +233,12 @@ function UnavailableWorkspaceLink({ children, className }) {
233
233
  * Markdown-compatible anchor that resolves local files through the nearest
234
234
  * workspace navigation provider while preserving native link behavior.
235
235
  */
236
- function WorkspaceFileLink({ children, className, download, href = "", node: _node, onClick, rel, target, ...props }) {
236
+ function WorkspaceFileLink({ children, className, download, href = "", node, onClick, rel, target, ...props }) {
237
237
  const workspace = useWorkspaceNavigationContext();
238
238
  const restoration = useWorkspaceNavigationRestoration();
239
239
  if (!workspace) return /* @__PURE__ */ jsx("a", {
240
240
  className,
241
+ "data-streamdown": node ? "link" : void 0,
241
242
  download,
242
243
  href,
243
244
  onClick,
@@ -259,7 +260,7 @@ function WorkspaceFileLink({ children, className, download, href = "", node: _no
259
260
  const externalTarget = target ?? "_blank";
260
261
  return /* @__PURE__ */ jsxs("a", {
261
262
  className: cx("workspace-link workspace-link--external", className),
262
- "data-streamdown": "link",
263
+ "data-streamdown": node ? "link" : void 0,
263
264
  download,
264
265
  href: resolved.href,
265
266
  onClick,
@@ -285,7 +286,7 @@ function WorkspaceFileLink({ children, className, download, href = "", node: _no
285
286
  return /* @__PURE__ */ jsx(NavigationLink, {
286
287
  render: workspace.navigation.renderLink(resolved),
287
288
  className: cx("workspace-link workspace-link--file", className),
288
- "data-streamdown": "link",
289
+ "data-streamdown": node ? "link" : void 0,
289
290
  "data-workspace-link": "file",
290
291
  "data-workspace-destination-fragment": resolved.fragment ?? "",
291
292
  "data-workspace-path": resolved.path,
@@ -1,7 +1,7 @@
1
1
  import { MessageResponse } from "./components/ai-sdk/Message.js";
2
- import { c as useWorkspaceNavigationContext, r as resolveWorkspaceLink, t as WorkspaceFileLink } from "./WorkspaceLink-DZeLe_jN.js";
2
+ import { c as useWorkspaceNavigationContext, r as resolveWorkspaceLink, t as WorkspaceFileLink } from "./WorkspaceLink-DtH66bAY.js";
3
3
  import * as React from "react";
4
- import { jsx } from "react/jsx-runtime";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
5
  import { defaultRehypePlugins } from "streamdown";
6
6
  import { visit } from "unist-util-visit";
7
7
  //#region src/components/_internal/workspace-markdown.ts
@@ -84,17 +84,74 @@ const workspaceComponents = {
84
84
  a: WorkspaceFileLink
85
85
  };
86
86
  /** Adds workspace-aware Markdown links when rendered inside a workspace provider. */
87
- const WorkspaceMessageResponse = React.memo(function WorkspaceMessageResponse({ components, rehypePlugins, ...props }) {
87
+ const WorkspaceMessageResponse = React.memo(function WorkspaceMessageResponse({ components, rehypePlugins, renderWorkspaceHtmlArtifact, ...props }) {
88
88
  const workspace = useWorkspaceNavigationContext();
89
89
  const resolvedRehypePlugins = React.useMemo(() => rehypePlugins ?? (workspace ? createWorkspaceRehypePlugins(workspace.root, workspace.base) : void 0), [rehypePlugins, workspace]);
90
90
  return /* @__PURE__ */ jsx(MessageResponse, {
91
- components: components ? {
92
- ...workspaceComponents,
93
- ...components
94
- } : workspaceComponents,
91
+ components: React.useMemo(() => {
92
+ const merged = components ? {
93
+ ...workspaceComponents,
94
+ ...components
95
+ } : workspaceComponents;
96
+ if (!workspace || !renderWorkspaceHtmlArtifact) return merged;
97
+ const FallbackParagraph = components?.p ?? "p";
98
+ return {
99
+ ...merged,
100
+ p: function WorkspaceHtmlArtifactParagraph({ node, children, ...paragraphProps }) {
101
+ const renderFallbackParagraph = (content) => React.createElement(FallbackParagraph, typeof FallbackParagraph === "string" ? paragraphProps : {
102
+ node,
103
+ ...paragraphProps
104
+ }, content);
105
+ const artifact = getWorkspaceHtmlArtifactParagraph(node, workspace.root, workspace.base);
106
+ if (!artifact) return renderFallbackParagraph(children);
107
+ const remainingChildren = React.Children.toArray(children).filter((_child, index) => index !== artifact.childIndex);
108
+ return /* @__PURE__ */ jsxs(Fragment, { children: [artifact.showRemainingChildren ? renderFallbackParagraph(remainingChildren) : null, renderWorkspaceHtmlArtifact({
109
+ label: artifact.label,
110
+ path: artifact.path,
111
+ sourceLink: /* @__PURE__ */ jsx(WorkspaceFileLink, { href: artifact.path })
112
+ })] });
113
+ }
114
+ };
115
+ }, [
116
+ components,
117
+ renderWorkspaceHtmlArtifact,
118
+ workspace
119
+ ]),
95
120
  rehypePlugins: resolvedRehypePlugins,
96
121
  ...props
97
122
  });
98
123
  });
124
+ function getWorkspaceHtmlArtifactParagraph(node, root, base) {
125
+ if (!node || node.tagName !== "p") return null;
126
+ const children = node.children;
127
+ const matches = children.flatMap((child, childIndex) => {
128
+ if (child.type !== "element" || child.tagName !== "a") return [];
129
+ const href = child.properties?.href;
130
+ if (typeof href !== "string") return [];
131
+ const destination = resolveWorkspaceLink({
132
+ href,
133
+ root,
134
+ base
135
+ });
136
+ if (destination.kind !== "file" || destination.fragment !== null || !destination.path.toLowerCase().endsWith(".html")) return [];
137
+ return [{
138
+ anchor: child,
139
+ childIndex,
140
+ path: destination.path
141
+ }];
142
+ });
143
+ if (matches.length !== 1) return null;
144
+ const [{ anchor, childIndex, path }] = matches;
145
+ return {
146
+ childIndex,
147
+ path,
148
+ label: markdownText(anchor).trim() || path.split("/").at(-1) || "Interactive UI",
149
+ showRemainingChildren: children.some((child, index) => index !== childIndex && (child.type !== "text" || child.value.trim()))
150
+ };
151
+ }
152
+ function markdownText(node) {
153
+ if (node.type === "text") return node.value;
154
+ return node.type === "element" ? node.children.map(markdownText).join("") : "";
155
+ }
99
156
  //#endregion
100
157
  export { createWorkspaceRehypePlugins as n, WorkspaceMessageResponse as t };
@@ -0,0 +1,24 @@
1
+ import { w as MessageResponseProps } from "./Message-DBsHHhcM.js";
2
+ import * as React from "react";
3
+
4
+ //#region src/components/agents-sdk/WorkspaceMessageResponse.d.ts
5
+ interface WorkspaceHtmlArtifactRenderInput {
6
+ label: string;
7
+ path: string;
8
+ /** Shared workspace link element; hosts pass it through to the preview unchanged. */
9
+ sourceLink: React.ReactElement;
10
+ }
11
+ type WorkspaceHtmlArtifactRenderer = (artifact: WorkspaceHtmlArtifactRenderInput) => React.ReactNode;
12
+ interface WorkspaceMessageResponseProps extends MessageResponseProps {
13
+ /** Promotes one standalone workspace HTML link into host-hydrated shared UI. */
14
+ renderWorkspaceHtmlArtifact?: WorkspaceHtmlArtifactRenderer;
15
+ }
16
+ /** Adds workspace-aware Markdown links when rendered inside a workspace provider. */
17
+ declare const WorkspaceMessageResponse: React.MemoExoticComponent<({
18
+ components,
19
+ rehypePlugins,
20
+ renderWorkspaceHtmlArtifact,
21
+ ...props
22
+ }: WorkspaceMessageResponseProps) => React.JSX.Element>;
23
+ //#endregion
24
+ export { WorkspaceMessageResponseProps as i, WorkspaceHtmlArtifactRenderer as n, WorkspaceMessageResponse as r, WorkspaceHtmlArtifactRenderInput as t };
@@ -1,2 +1,2 @@
1
- import { a as AgentActivityIconProps, i as AgentActivityIconKind, n as AgentActivityFaviconProps, o as AgentActivityMode, r as AgentActivityIcon, s as AgentActivitySummary, t as AgentActivityFavicon } from "../../AgentActivity-SP1WfLDW.js";
1
+ import { a as AgentActivityIconProps, i as AgentActivityIconKind, n as AgentActivityFaviconProps, o as AgentActivityMode, r as AgentActivityIcon, s as AgentActivitySummary, t as AgentActivityFavicon } from "../../AgentActivity-Cc_oDYum.js";
2
2
  export { AgentActivityFavicon, AgentActivityFaviconProps, AgentActivityIcon, AgentActivityIconKind, AgentActivityIconProps, AgentActivityMode, AgentActivitySummary };
@@ -1,5 +1,5 @@
1
- import { n as WorkspaceDestination } from "../../WorkspaceLink-DQogVe8E.js";
2
- import { s as AgentActivitySummary } from "../../AgentActivity-SP1WfLDW.js";
1
+ import { n as WorkspaceDestination } from "../../WorkspaceLink-Bh9-Jo1r.js";
2
+ import { s as AgentActivitySummary } from "../../AgentActivity-Cc_oDYum.js";
3
3
  import * as React from "react";
4
4
 
5
5
  //#region src/components/agents-sdk/AgentActivityPreview.d.ts
@@ -2,8 +2,8 @@ import { t as cx } from "../../class-names-BiMDVpUo.js";
2
2
  import { C as FileIcon, J as SpinnerIcon, j as McpIcon, rt as XIcon, tt as WarningIcon } from "../../icons-B4mGvCvc.js";
3
3
  import { ActivityHeader } from "../ai-sdk/Activity.js";
4
4
  import { Button } from "../foundations/Button.js";
5
- import { AppIcon } from "../foundations/AppIcon.js";
6
5
  import { t as NavigationLink } from "../../navigation-link-kqMa81v5.js";
6
+ import { AppIcon } from "../foundations/AppIcon.js";
7
7
  import { AgentActivityFavicon, AgentActivityIcon } from "./AgentActivity.js";
8
8
  import "react";
9
9
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -3,9 +3,10 @@ import { K as PromptInputMessage } from "../../PromptInput-BRX7FhjH.js";
3
3
  import { r as AgentChatProps } from "../../AgentChat-CVO7xyLC.js";
4
4
  import { n as AgentToolEventsValue } from "../../AgentToolRunsContext-BCVqCtJ1.js";
5
5
  import { o as UseSessionCompactionResult } from "../../SessionCompaction-CmTJFpzj.js";
6
- import { o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, t as ThinkChatActivity } from "../../ThinkChatActivity-Dkmm2pIj.js";
6
+ import { o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, t as ThinkChatActivity } from "../../ThinkChatActivity-D6-_5Phw.js";
7
7
  import { i as ThinkChatValue } from "../../ThinkChatContext-COIgzkYp.js";
8
8
  import { t as ThinkRecoveryNotice } from "../../ThinkRecoveryNotice-DGWr94rk.js";
9
+ import { n as WorkspaceHtmlArtifactRenderer } from "../../WorkspaceMessageResponse-Cy28WGSz.js";
9
10
  import * as React from "react";
10
11
  import { UIMessage } from "ai";
11
12
  import { UseAgentOptions } from "agents/react";
@@ -67,7 +68,8 @@ type ThinkChatMessagesProps<MessageT extends UIMessage = UIMessage> = Omit<Agent
67
68
  * that does not exist yet.
68
69
  */
69
70
  draft?: ThinkChatDraft<MessageT>; /** Whole `useSessionCompaction` result for built-in progress and error notices. */
70
- sessionCompaction?: UseSessionCompactionResult;
71
+ sessionCompaction?: UseSessionCompactionResult; /** Promotes assistant-authored workspace HTML links through a host runtime hydrator. */
72
+ renderWorkspaceHtmlArtifact?: WorkspaceHtmlArtifactRenderer;
71
73
  };
72
74
  /** Shared pending-approval options for components and TanStack Router loaders. */
73
75
  declare function thinkPendingExecutionApprovalsQueryOptions(stub: AgentStub<Think>, sourceKey: string): ThinkPendingExecutionApprovalsQueryOptions;
@@ -128,6 +130,7 @@ declare function ThinkChatMessages<State = unknown, MessageT extends UIMessage =
128
130
  renderPart,
129
131
  excludeTools,
130
132
  renderAgentToolRunLink,
133
+ renderWorkspaceHtmlArtifact,
131
134
  toolRenderers,
132
135
  thinkStub,
133
136
  onExecutionSettled,
@@ -1,2 +1,2 @@
1
- import { a as thinkPendingExecutionApprovalsQueryOptions, i as ThinkChatRoot, n as ThinkChatMessages, o as useThinkChat, r as ThinkChatProvider, s as useThinkPendingExecutionApprovals, t as ThinkChat } from "../../ThinkChat-DQh59CeC.js";
1
+ import { a as thinkPendingExecutionApprovalsQueryOptions, i as ThinkChatRoot, n as ThinkChatMessages, o as useThinkChat, r as ThinkChatProvider, s as useThinkPendingExecutionApprovals, t as ThinkChat } from "../../ThinkChat-DkA4Wr71.js";
2
2
  export { ThinkChat, ThinkChatMessages, ThinkChatProvider, ThinkChatRoot, thinkPendingExecutionApprovalsQueryOptions, useThinkChat, useThinkPendingExecutionApprovals };
@@ -1,2 +1,2 @@
1
- import { a as ThinkChatToolRenderers, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as renderThinkChatActivityPart, t as ThinkChatActivity } from "../../ThinkChatActivity-Dkmm2pIj.js";
1
+ import { a as ThinkChatToolRenderers, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as renderThinkChatActivityPart, t as ThinkChatActivity } from "../../ThinkChatActivity-D6-_5Phw.js";
2
2
  export { ThinkChatActivity, ThinkChatActivityProps, ThinkChatActivityRendererOptions, ThinkChatToolRenderer, ThinkChatToolRenderers, createThinkChatActivityRenderer, renderThinkChatActivityPart };
@@ -1,2 +1,2 @@
1
- import { a as ThinkChatToolLifecycleSnapshot, c as deriveThinkChatActivityHeader, d as summarizeActivitySteps, i as ThinkChatToolDescribers, l as deriveThinkChatToolLifecycleHeader, n as ThinkChatActivityHeader, o as activityPartIconKind, r as ThinkChatToolDescriber, s as activityPartUrl, t as ThinkChatActivityDescription, u as describeThinkChatActivityPart } from "../../ThinkChatActivitySummary-teRjrPxW.js";
1
+ import { a as ThinkChatToolLifecycleSnapshot, c as deriveThinkChatActivityHeader, d as summarizeActivitySteps, i as ThinkChatToolDescribers, l as deriveThinkChatToolLifecycleHeader, n as ThinkChatActivityHeader, o as activityPartIconKind, r as ThinkChatToolDescriber, s as activityPartUrl, t as ThinkChatActivityDescription, u as describeThinkChatActivityPart } from "../../ThinkChatActivitySummary-BtBQgMg6.js";
2
2
  export { ThinkChatActivityDescription, ThinkChatActivityHeader, ThinkChatToolDescriber, ThinkChatToolDescribers, ThinkChatToolLifecycleSnapshot, activityPartIconKind, activityPartUrl, deriveThinkChatActivityHeader, deriveThinkChatToolLifecycleHeader, describeThinkChatActivityPart, summarizeActivitySteps };
@@ -4,9 +4,9 @@ import { buttonVariants } from "../foundations/Button.js";
4
4
  import { IconButton } from "../foundations/IconButton.js";
5
5
  import { Menu } from "../foundations/Menu.js";
6
6
  import { i as formatErrorMessage } from "../../format-DB2mX9DA.js";
7
+ import { t as NavigationLink } from "../../navigation-link-kqMa81v5.js";
7
8
  import { EmptyState } from "../foundations/EmptyState.js";
8
9
  import { AppTopBar } from "../general-purpose/AppTopBar.js";
9
- import { t as NavigationLink } from "../../navigation-link-kqMa81v5.js";
10
10
  import { getThinkExecutionRunAccessibleName, getThinkExecutionRunId, getThinkExecutionRunStatus, getThinkExecutionRunStatusTone, isSameThinkExecutionRun, isThinkSubmissionRun } from "./ThinkExecutionRun.js";
11
11
  import { ThinkExecutionRunSummary } from "./ThinkExecutionStatus.js";
12
12
  import { ThinkExecutionDetail } from "./ThinkExecutionDetail.js";
@@ -1,4 +1,4 @@
1
- import { l as WorkspaceNavigationAdapter } from "../../WorkspaceLink-DQogVe8E.js";
1
+ import { l as WorkspaceNavigationAdapter } from "../../WorkspaceLink-Bh9-Jo1r.js";
2
2
  import { n as AgentToolEventsValue } from "../../AgentToolRunsContext-BCVqCtJ1.js";
3
3
  import { McpPluginCatalogProps } from "./McpPluginCatalog.js";
4
4
  import { ThinkChatMessagesProps } from "./ThinkChat.js";
@@ -5,8 +5,8 @@ import { n as mergeRefs } from "../../merge-refs-DF_7w2x_.js";
5
5
  import { ScrollArea } from "../foundations/ScrollArea.js";
6
6
  import { AppTopBar } from "../general-purpose/AppTopBar.js";
7
7
  import { ResizableSidePanel } from "../general-purpose/ResizableSidePanel.js";
8
- import { a as WorkspaceNavigationRestorationBoundary, i as WorkspaceNavigationFocusRestorer, n as WorkspaceNavigationProvider } from "../../WorkspaceLink-DZeLe_jN.js";
9
- import { c as resolveThinkApprovalProps, s as useThinkPendingExecutionApprovals, t as ThinkChat } from "../../ThinkChat-DQh59CeC.js";
8
+ import { a as WorkspaceNavigationRestorationBoundary, i as WorkspaceNavigationFocusRestorer, n as WorkspaceNavigationProvider } from "../../WorkspaceLink-DtH66bAY.js";
9
+ import { c as resolveThinkApprovalProps, s as useThinkPendingExecutionApprovals, t as ThinkChat } from "../../ThinkChat-DkA4Wr71.js";
10
10
  import { McpPluginCatalog } from "./McpPluginCatalog.js";
11
11
  import { ThinkExecutionWorkbench } from "./ThinkExecutionWorkbench.js";
12
12
  import { ThinkFullAppViewSwitch } from "./ThinkFullAppViewSwitch.js";
@@ -3,10 +3,10 @@ import { H as PlusIcon } from "../../icons-B4mGvCvc.js";
3
3
  import { buttonVariants } from "../foundations/Button.js";
4
4
  import { Tooltip } from "../foundations/Tooltip.js";
5
5
  import { t as capitalize } from "../../format-DB2mX9DA.js";
6
+ import { t as NavigationLink } from "../../navigation-link-kqMa81v5.js";
6
7
  import { EmptyState } from "../foundations/EmptyState.js";
7
8
  import { SearchField } from "../foundations/SearchField.js";
8
9
  import { ToggleGroup } from "../foundations/ToggleGroup.js";
9
- import { t as NavigationLink } from "../../navigation-link-kqMa81v5.js";
10
10
  import { getThinkRoutineNextRun } from "./ThinkRoutine.js";
11
11
  import * as React from "react";
12
12
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -4,8 +4,8 @@ import { Button, buttonVariants } from "../foundations/Button.js";
4
4
  import { Field } from "../foundations/Field.js";
5
5
  import { Form } from "../foundations/Form.js";
6
6
  import { Textarea } from "../foundations/Textarea.js";
7
- import { Select } from "../foundations/Select.js";
8
7
  import { t as NavigationLink } from "../../navigation-link-kqMa81v5.js";
8
+ import { Select } from "../foundations/Select.js";
9
9
  import * as React from "react";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  //#region src/components/agents-sdk/ThinkRoutineForm.tsx
@@ -3,10 +3,10 @@ import { J as SpinnerIcon, V as PlayIcon, b as EllipsisIcon, f as ChevronDownIco
3
3
  import { Button, buttonVariants } from "../foundations/Button.js";
4
4
  import { Menu } from "../foundations/Menu.js";
5
5
  import { i as formatErrorMessage } from "../../format-DB2mX9DA.js";
6
+ import { n as isPlainPrimaryLinkActivation, t as NavigationLink } from "../../navigation-link-kqMa81v5.js";
6
7
  import { AlertDialog } from "../foundations/AlertDialog.js";
7
8
  import { EmptyState } from "../foundations/EmptyState.js";
8
9
  import { AppTopBar } from "../general-purpose/AppTopBar.js";
9
- import { n as isPlainPrimaryLinkActivation, t as NavigationLink } from "../../navigation-link-kqMa81v5.js";
10
10
  import { ResponsiveSidebarShell } from "../general-purpose/ResponsiveSidebarShell.js";
11
11
  import { ThinkRoutineBrowser } from "./ThinkRoutineBrowser.js";
12
12
  import { ThinkRoutineDetail } from "./ThinkRoutineDetail.js";
@@ -1,8 +1,8 @@
1
1
  import { t as cx } from "../../class-names-BiMDVpUo.js";
2
2
  import { buttonVariants } from "../foundations/Button.js";
3
+ import { t as NavigationLink } from "../../navigation-link-kqMa81v5.js";
3
4
  import { Badge } from "../foundations/Badge.js";
4
5
  import { EmptyState } from "../foundations/EmptyState.js";
5
- import { t as NavigationLink } from "../../navigation-link-kqMa81v5.js";
6
6
  import { getThinkExecutionRunAccessibleName, getThinkExecutionRunId, isThinkSubmissionRun } from "./ThinkExecutionRun.js";
7
7
  import { ThinkExecutionRunSummary } from "./ThinkExecutionStatus.js";
8
8
  import * as React from "react";
@@ -2,11 +2,11 @@ import { t as cx } from "../../class-names-BiMDVpUo.js";
2
2
  import { H as PlusIcon, J as SpinnerIcon, t as ArchiveIcon, tt as WarningIcon, v as DotIcon } from "../../icons-B4mGvCvc.js";
3
3
  import { Button, buttonVariants } from "../foundations/Button.js";
4
4
  import { i as formatErrorMessage } from "../../format-DB2mX9DA.js";
5
+ import { n as isPlainPrimaryLinkActivation, t as NavigationLink } from "../../navigation-link-kqMa81v5.js";
5
6
  import { ScrollArea } from "../foundations/ScrollArea.js";
6
7
  import { AlertDialog } from "../foundations/AlertDialog.js";
7
8
  import { EmptyState } from "../foundations/EmptyState.js";
8
9
  import { SearchField } from "../foundations/SearchField.js";
9
- import { n as isPlainPrimaryLinkActivation, t as NavigationLink } from "../../navigation-link-kqMa81v5.js";
10
10
  import * as React from "react";
11
11
  import { jsx, jsxs } from "react/jsx-runtime";
12
12
  //#region src/components/agents-sdk/ThinkThreadPicker.tsx
@@ -1,4 +1,4 @@
1
- import { l as WorkspaceNavigationAdapter } from "../../WorkspaceLink-DQogVe8E.js";
1
+ import { l as WorkspaceNavigationAdapter } from "../../WorkspaceLink-Bh9-Jo1r.js";
2
2
  import { WorkspaceState } from "./Workspace.js";
3
3
  import * as React from "react";
4
4
 
@@ -1,8 +1,8 @@
1
1
  import { t as cx } from "../../class-names-BiMDVpUo.js";
2
2
  import { n as mergeRefs } from "../../merge-refs-DF_7w2x_.js";
3
- import { a as WorkspaceNavigationRestorationBoundary, n as WorkspaceNavigationProvider, o as useRequiredWorkspaceNavigationRestoration, r as resolveWorkspaceLink } from "../../WorkspaceLink-DZeLe_jN.js";
3
+ import { a as WorkspaceNavigationRestorationBoundary, n as WorkspaceNavigationProvider, o as useRequiredWorkspaceNavigationRestoration, r as resolveWorkspaceLink } from "../../WorkspaceLink-DtH66bAY.js";
4
4
  import { WorkspaceBrowser } from "./WorkspaceBrowser.js";
5
- import { t as WorkspaceFileView } from "../../WorkspaceFileView-Cu_ZG6HJ.js";
5
+ import { t as WorkspaceFileView } from "../../WorkspaceFileView-DeGzWwhK.js";
6
6
  import * as React from "react";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  //#region src/components/agents-sdk/WorkspaceExplorer.tsx
@@ -1,2 +1,2 @@
1
- import { t as WorkspaceFileView } from "../../WorkspaceFileView-Cu_ZG6HJ.js";
1
+ import { t as WorkspaceFileView } from "../../WorkspaceFileView-DeGzWwhK.js";
2
2
  export { WorkspaceFileView };
@@ -1,2 +1,2 @@
1
- import { a as WorkspaceFileLinkProps, c as WorkspaceLinkResolution, d as WorkspaceNavigationProvider, f as WorkspaceNavigationProviderProps, i as WorkspaceFileLink, l as WorkspaceNavigationAdapter, n as WorkspaceDestination, o as WorkspaceInvalidDestination, p as resolveWorkspaceLink, r as WorkspaceExternalDestination, s as WorkspaceLinkBase, t as ResolveWorkspaceLinkOptions, u as WorkspaceNavigationEntry } from "../../WorkspaceLink-DQogVe8E.js";
1
+ import { a as WorkspaceFileLinkProps, c as WorkspaceLinkResolution, d as WorkspaceNavigationProvider, f as WorkspaceNavigationProviderProps, i as WorkspaceFileLink, l as WorkspaceNavigationAdapter, n as WorkspaceDestination, o as WorkspaceInvalidDestination, p as resolveWorkspaceLink, r as WorkspaceExternalDestination, s as WorkspaceLinkBase, t as ResolveWorkspaceLinkOptions, u as WorkspaceNavigationEntry } from "../../WorkspaceLink-Bh9-Jo1r.js";
2
2
  export { ResolveWorkspaceLinkOptions, WorkspaceDestination, WorkspaceExternalDestination, WorkspaceFileLink, WorkspaceFileLinkProps, WorkspaceInvalidDestination, WorkspaceLinkBase, WorkspaceLinkResolution, WorkspaceNavigationAdapter, WorkspaceNavigationEntry, WorkspaceNavigationProvider, WorkspaceNavigationProviderProps, resolveWorkspaceLink };
@@ -1,2 +1,2 @@
1
- import { n as WorkspaceNavigationProvider, r as resolveWorkspaceLink, t as WorkspaceFileLink } from "../../WorkspaceLink-DZeLe_jN.js";
1
+ import { n as WorkspaceNavigationProvider, r as resolveWorkspaceLink, t as WorkspaceFileLink } from "../../WorkspaceLink-DtH66bAY.js";
2
2
  export { WorkspaceFileLink, WorkspaceNavigationProvider, resolveWorkspaceLink };
@@ -1,12 +1,2 @@
1
- import { MessageResponseProps } from "../ai-sdk/Message.js";
2
- import * as React from "react";
3
-
4
- //#region src/components/agents-sdk/WorkspaceMessageResponse.d.ts
5
- /** Adds workspace-aware Markdown links when rendered inside a workspace provider. */
6
- declare const WorkspaceMessageResponse: React.MemoExoticComponent<({
7
- components,
8
- rehypePlugins,
9
- ...props
10
- }: MessageResponseProps) => React.JSX.Element>;
11
- //#endregion
12
- export { WorkspaceMessageResponse };
1
+ import { i as WorkspaceMessageResponseProps, n as WorkspaceHtmlArtifactRenderer, r as WorkspaceMessageResponse, t as WorkspaceHtmlArtifactRenderInput } from "../../WorkspaceMessageResponse-Cy28WGSz.js";
2
+ export { WorkspaceHtmlArtifactRenderInput, WorkspaceHtmlArtifactRenderer, WorkspaceMessageResponse, WorkspaceMessageResponseProps };
@@ -1,2 +1,2 @@
1
- import { t as WorkspaceMessageResponse } from "../../WorkspaceMessageResponse-BWbkIELl.js";
1
+ import { t as WorkspaceMessageResponse } from "../../WorkspaceMessageResponse-CJCmGvTx.js";
2
2
  export { WorkspaceMessageResponse };
@@ -118,5 +118,48 @@ declare function ArtifactContent({
118
118
  }: ArtifactContentProps & {
119
119
  ref?: React.Ref<HTMLDivElement>;
120
120
  }): React.JSX.Element;
121
+ /** Host error messages render verbatim and must be user-readable rather than raw diagnostics.
122
+ * Sandbox policy is a host concern the preview never mediates: a host that blocks a resource
123
+ * reports it through the error states, so there is no approval state here. */
124
+ type ArtifactPreviewState = {
125
+ status: "loading";
126
+ } | {
127
+ message: string;
128
+ onRetry: () => void;
129
+ status: "error";
130
+ } | {
131
+ content: React.ReactNode;
132
+ status: "ready";
133
+ } | {
134
+ content: React.ReactNode;
135
+ message: string;
136
+ onRetry: () => void;
137
+ status: "runtime-error";
138
+ };
139
+ interface ArtifactPreviewProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
140
+ /** Accessible artifact name, usually derived from the source link label. */
141
+ label: string;
142
+ /** Navigation element for the source artifact. */
143
+ sourceLink: React.ReactElement;
144
+ /** Host-resolved artifact lifecycle facts and callables. */
145
+ state: ArtifactPreviewState;
146
+ }
147
+ /**
148
+ * Controlled inline preview for host-hydrated generated UI runtimes.
149
+ *
150
+ * The design system owns artifact chrome, status copy, disclosure, responsive
151
+ * layout, and accessible announcements. The host owns source reads, sandbox
152
+ * policy, runtime messaging, and the rendered content element.
153
+ */
154
+ declare function ArtifactPreview({
155
+ className,
156
+ label,
157
+ sourceLink,
158
+ state,
159
+ ref,
160
+ ...props
161
+ }: ArtifactPreviewProps & {
162
+ ref?: React.Ref<HTMLDivElement>;
163
+ }): React.JSX.Element;
121
164
  //#endregion
122
- export { Artifact, ArtifactAction, ArtifactActionProps, ArtifactActions, ArtifactActionsProps, ArtifactClose, ArtifactCloseProps, ArtifactContent, ArtifactContentProps, ArtifactDescription, ArtifactDescriptionProps, ArtifactHeader, ArtifactHeaderProps, ArtifactProps, ArtifactTitle, ArtifactTitleProps };
165
+ export { Artifact, ArtifactAction, ArtifactActionProps, ArtifactActions, ArtifactActionsProps, ArtifactClose, ArtifactCloseProps, ArtifactContent, ArtifactContentProps, ArtifactDescription, ArtifactDescriptionProps, ArtifactHeader, ArtifactHeaderProps, ArtifactPreview, ArtifactPreviewProps, ArtifactPreviewState, ArtifactProps, ArtifactTitle, ArtifactTitleProps };
@@ -1,8 +1,10 @@
1
1
  import { t as cx } from "../../class-names-BiMDVpUo.js";
2
- import { rt as XIcon } from "../../icons-B4mGvCvc.js";
2
+ import { J as SpinnerIcon, rt as XIcon, tt as WarningIcon } from "../../icons-B4mGvCvc.js";
3
+ import { Button, buttonVariants } from "../foundations/Button.js";
3
4
  import { IconButton } from "../foundations/IconButton.js";
5
+ import { t as NavigationLink } from "../../navigation-link-kqMa81v5.js";
4
6
  import "react";
5
- import { jsx } from "react/jsx-runtime";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
6
8
  //#region src/components/ai-sdk/Artifact.tsx
7
9
  /**
8
10
  * A container for generated content (code, documents, outputs) with a header
@@ -107,5 +109,79 @@ function ArtifactContent({ className, children, ref, ...props }) {
107
109
  children
108
110
  });
109
111
  }
112
+ /**
113
+ * Controlled inline preview for host-hydrated generated UI runtimes.
114
+ *
115
+ * The design system owns artifact chrome, status copy, disclosure, responsive
116
+ * layout, and accessible announcements. The host owns source reads, sandbox
117
+ * policy, runtime messaging, and the rendered content element.
118
+ */
119
+ function ArtifactPreview({ className, label, sourceLink, state, ref, ...props }) {
120
+ const liveMessage = state.status === "loading" ? "Loading interactive UI." : state.status === "error" ? `Interactive UI failed to load: ${state.message}` : state.status === "runtime-error" ? `Interactive UI error: ${state.message}` : "Interactive UI loaded.";
121
+ return /* @__PURE__ */ jsxs(Artifact, {
122
+ ref,
123
+ ...props,
124
+ "aria-busy": state.status === "loading" || void 0,
125
+ "aria-label": props["aria-label"] ?? label,
126
+ className: cx("artifact-preview", className),
127
+ "data-state": state.status,
128
+ role: props.role ?? "region",
129
+ children: [
130
+ /* @__PURE__ */ jsx("span", {
131
+ className: "sigvelo-visually-hidden",
132
+ role: "status",
133
+ "aria-atomic": "true",
134
+ children: liveMessage
135
+ }),
136
+ /* @__PURE__ */ jsx(ArtifactHeader, {
137
+ className: "artifact-preview__header",
138
+ children: /* @__PURE__ */ jsx(NavigationLink, {
139
+ render: sourceLink,
140
+ className: buttonVariants({
141
+ variant: "ghost",
142
+ color: "neutral",
143
+ size: "xs"
144
+ }),
145
+ children: "View source"
146
+ })
147
+ }),
148
+ state.status === "loading" ? /* @__PURE__ */ jsxs(ArtifactContent, {
149
+ className: "artifact-preview__status",
150
+ children: [/* @__PURE__ */ jsx(SpinnerIcon, {}), "Loading interactive UI…"]
151
+ }) : state.status === "error" ? /* @__PURE__ */ jsx(ArtifactPreviewError, {
152
+ message: state.message,
153
+ onRetry: state.onRetry
154
+ }) : /* @__PURE__ */ jsxs(ArtifactContent, {
155
+ className: "artifact-preview__frame-shell",
156
+ children: [/* @__PURE__ */ jsx("div", {
157
+ className: "artifact-preview__runtime",
158
+ inert: state.status === "runtime-error" || void 0,
159
+ children: state.content
160
+ }), state.status === "runtime-error" ? /* @__PURE__ */ jsx(ArtifactPreviewError, {
161
+ message: state.message,
162
+ onRetry: state.onRetry,
163
+ overlay: true
164
+ }) : null]
165
+ })
166
+ ]
167
+ });
168
+ }
169
+ function ArtifactPreviewError({ message, onRetry, overlay = false }) {
170
+ return /* @__PURE__ */ jsxs(ArtifactContent, {
171
+ className: cx("artifact-preview__status", overlay && "artifact-preview__status--overlay"),
172
+ children: [
173
+ /* @__PURE__ */ jsx(WarningIcon, {}),
174
+ /* @__PURE__ */ jsx("span", { children: message }),
175
+ /* @__PURE__ */ jsx(Button, {
176
+ type: "button",
177
+ variant: "outline",
178
+ color: "neutral",
179
+ size: "sm",
180
+ onClick: onRetry,
181
+ children: "Retry"
182
+ })
183
+ ]
184
+ });
185
+ }
110
186
  //#endregion
111
- export { Artifact, ArtifactAction, ArtifactActions, ArtifactClose, ArtifactContent, ArtifactDescription, ArtifactHeader, ArtifactTitle };
187
+ export { Artifact, ArtifactAction, ArtifactActions, ArtifactClose, ArtifactContent, ArtifactDescription, ArtifactHeader, ArtifactPreview, ArtifactTitle };
@@ -1,228 +1,2 @@
1
- import { n as IconButtonProps } from "../../IconButton-BAUFhUk8.js";
2
- import * as React from "react";
3
- import { FileUIPart, UIMessage } from "ai";
4
- import { StreamdownProps } from "streamdown";
5
-
6
- //#region src/components/ai-sdk/Message.d.ts
7
- type MessageRole = UIMessage["role"];
8
- interface MessageProps extends React.HTMLAttributes<HTMLDivElement> {
9
- /**
10
- * The originating role of the message. Controls alignment and styling via
11
- * the `data-from` attribute (e.g. user messages align end).
12
- */
13
- from?: MessageRole;
14
- }
15
- /**
16
- * A chat message row. Aligns and styles itself based on {@link from}.
17
- * Adapted from Vercel AI Elements and restyled with Sigvelo CSS tokens.
18
- *
19
- * Compose with {@link MessageContent} for the bubble, {@link MessageActions}
20
- * for toolbar actions, and {@link MessageBranch} for multi-version responses.
21
- *
22
- * @example
23
- * ```tsx
24
- * <Message from="assistant">
25
- * <MessageContent>Hello there!</MessageContent>
26
- * <MessageActions>
27
- * <MessageAction label="Copy" tooltip="Copy to clipboard">
28
- * <CopyIcon />
29
- * </MessageAction>
30
- * </MessageActions>
31
- * </Message>
32
- * ```
33
- *
34
- * @see {@link https://elements.ai-sdk.dev/components/message | AI Elements Message}
35
- */
36
- declare function Message({
37
- className,
38
- from,
39
- children,
40
- ref,
41
- ...props
42
- }: MessageProps & {
43
- ref?: React.Ref<HTMLDivElement>;
44
- }): React.JSX.Element;
45
- interface MessageContentProps extends React.HTMLAttributes<HTMLDivElement> {}
46
- /**
47
- * The visible bubble/body of a message. Styled differently based on the
48
- * parent {@link Message}'s `from` attribute.
49
- */
50
- declare function MessageContent({
51
- className,
52
- children,
53
- ref,
54
- ...props
55
- }: MessageContentProps & {
56
- ref?: React.Ref<HTMLDivElement>;
57
- }): React.JSX.Element;
58
- type MessageResponseProps = StreamdownProps;
59
- declare const MessageResponse: React.MemoExoticComponent<({
60
- className,
61
- components,
62
- ...props
63
- }: MessageResponseProps) => React.JSX.Element>;
64
- interface MessageAttachmentProps extends Omit<React.HTMLAttributes<HTMLElement>, "color" | "part"> {
65
- /** The AI SDK `file` part, taken whole. */
66
- part: FileUIPart;
67
- }
68
- /**
69
- * A `file` part inside a message: images render inline (click to zoom),
70
- * anything else becomes a download chip. Covers both directions — files the
71
- * user attached and files the agent emitted.
72
- */
73
- declare function MessageAttachment({
74
- part,
75
- className,
76
- ...props
77
- }: MessageAttachmentProps): React.JSX.Element;
78
- interface MessageActionsProps extends React.HTMLAttributes<HTMLDivElement> {}
79
- /**
80
- * Horizontal list of action buttons (copy, retry, thumbs-up, etc.) shown
81
- * alongside or beneath a message.
82
- */
83
- declare function MessageActions({
84
- className,
85
- children,
86
- ref,
87
- ...props
88
- }: MessageActionsProps & {
89
- ref?: React.Ref<HTMLDivElement>;
90
- }): React.JSX.Element;
91
- interface MessageActionProps extends Omit<IconButtonProps, "children"> {
92
- children?: React.ReactNode;
93
- }
94
- /**
95
- * A single icon button inside {@link MessageActions}. Always has an accessible
96
- * name; shows a tooltip on hover/focus when {@link tooltip} is set.
97
- */
98
- declare function MessageAction({
99
- className,
100
- label,
101
- tooltip,
102
- variant,
103
- color,
104
- size,
105
- children,
106
- ref,
107
- ...props
108
- }: MessageActionProps & {
109
- ref?: React.Ref<HTMLButtonElement>;
110
- }): React.JSX.Element;
111
- interface MessageToolbarProps extends React.HTMLAttributes<HTMLDivElement> {}
112
- /**
113
- * Horizontal container that places children in a row with space between —
114
- * typically a {@link MessageBranchSelector} on one side and
115
- * {@link MessageActions} on the other.
116
- */
117
- declare function MessageToolbar({
118
- className,
119
- children,
120
- ref,
121
- ...props
122
- }: MessageToolbarProps & {
123
- ref?: React.Ref<HTMLDivElement>;
124
- }): React.JSX.Element;
125
- interface MessageBranchProps extends React.HTMLAttributes<HTMLDivElement> {
126
- /** Number of response branches rendered by MessageBranchContent. */
127
- branchCount: number;
128
- /** Zero-based index of the initially selected branch. */
129
- defaultBranch?: number;
130
- /** Controlled branch index. */
131
- branch?: number;
132
- /** Called when the selected branch changes. */
133
- onBranchChange?: (branchIndex: number) => void;
134
- }
135
- /**
136
- * Container for a message response with multiple versions. Tracks which
137
- * branch is active and exposes navigation through {@link MessageBranchSelector},
138
- * {@link MessageBranchPrevious}, {@link MessageBranchNext}, and {@link MessageBranchPage}.
139
- */
140
- declare function MessageBranch({
141
- className,
142
- branchCount,
143
- defaultBranch,
144
- branch,
145
- onBranchChange,
146
- children,
147
- ref,
148
- ...props
149
- }: MessageBranchProps & {
150
- ref?: React.Ref<HTMLDivElement>;
151
- }): React.JSX.Element;
152
- interface MessageBranchContentProps extends React.HTMLAttributes<HTMLDivElement> {}
153
- /**
154
- * Renders only the active branch's child. Expects siblings to represent
155
- * alternative versions of the same response.
156
- */
157
- declare function MessageBranchContent({
158
- className,
159
- children,
160
- ref,
161
- ...props
162
- }: MessageBranchContentProps & {
163
- ref?: React.Ref<HTMLDivElement>;
164
- }): React.JSX.Element;
165
- interface MessageBranchSelectorProps extends React.HTMLAttributes<HTMLDivElement> {}
166
- /**
167
- * Inline group containing branch navigation controls (previous / page /
168
- * next). Hidden automatically when there is only one branch.
169
- */
170
- declare function MessageBranchSelector({
171
- className,
172
- children,
173
- ref,
174
- ...props
175
- }: MessageBranchSelectorProps & {
176
- ref?: React.Ref<HTMLDivElement>;
177
- }): React.JSX.Element | null;
178
- interface MessageBranchPreviousProps extends Omit<IconButtonProps, "children" | "label"> {
179
- label?: string;
180
- children?: React.ReactNode;
181
- }
182
- /** Button that selects the previous branch. Disabled at the first branch. */
183
- declare function MessageBranchPrevious({
184
- className,
185
- label,
186
- variant,
187
- color,
188
- size,
189
- children,
190
- onClick,
191
- ref,
192
- ...props
193
- }: MessageBranchPreviousProps & {
194
- ref?: React.Ref<HTMLButtonElement>;
195
- }): React.JSX.Element;
196
- interface MessageBranchNextProps extends Omit<IconButtonProps, "children" | "label"> {
197
- label?: string;
198
- children?: React.ReactNode;
199
- }
200
- /** Button that selects the next branch. Disabled at the last branch. */
201
- declare function MessageBranchNext({
202
- className,
203
- label,
204
- variant,
205
- color,
206
- size,
207
- children,
208
- onClick,
209
- ref,
210
- ...props
211
- }: MessageBranchNextProps & {
212
- ref?: React.Ref<HTMLButtonElement>;
213
- }): React.JSX.Element;
214
- interface MessageBranchPageProps extends React.HTMLAttributes<HTMLSpanElement> {
215
- /** Customize the displayed text. Defaults to `{index} / {count}`. */
216
- format?: (currentIndex: number, total: number) => React.ReactNode;
217
- }
218
- /** Page indicator (e.g. "1 / 3") for the current branch selection. */
219
- declare function MessageBranchPage({
220
- className,
221
- format,
222
- ref,
223
- ...props
224
- }: MessageBranchPageProps & {
225
- ref?: React.Ref<HTMLSpanElement>;
226
- }): React.JSX.Element;
227
- //#endregion
1
+ import { C as MessageResponse, D as MessageToolbarProps, E as MessageToolbar, S as MessageProps, T as MessageRole, _ as MessageBranchProps, a as MessageActionsProps, b as MessageContent, c as MessageBranch, d as MessageBranchNext, f as MessageBranchNextProps, g as MessageBranchPreviousProps, h as MessageBranchPrevious, i as MessageActions, l as MessageBranchContent, m as MessageBranchPageProps, n as MessageAction, o as MessageAttachment, p as MessageBranchPage, r as MessageActionProps, s as MessageAttachmentProps, t as Message, u as MessageBranchContentProps, v as MessageBranchSelector, w as MessageResponseProps, x as MessageContentProps, y as MessageBranchSelectorProps } from "../../Message-DBsHHhcM.js";
228
2
  export { Message, MessageAction, MessageActionProps, MessageActions, MessageActionsProps, MessageAttachment, MessageAttachmentProps, MessageBranch, MessageBranchContent, MessageBranchContentProps, MessageBranchNext, MessageBranchNextProps, MessageBranchPage, MessageBranchPageProps, MessageBranchPrevious, MessageBranchPreviousProps, MessageBranchProps, MessageBranchSelector, MessageBranchSelectorProps, MessageContent, MessageContentProps, MessageProps, MessageResponse, MessageResponseProps, MessageRole, MessageToolbar, MessageToolbarProps };
@@ -5,7 +5,7 @@ import { AppTopBar } from "../general-purpose/AppTopBar.js";
5
5
  import { NaniteMark } from "./NaniteScene.js";
6
6
  import { SubagentRunIndicator, getSubagentRunName } from "../agents-sdk/SubagentRunIndicator.js";
7
7
  import { SubagentRunActions, SubagentRunMilestone, SubagentRunMilestones, SubagentRunProgress } from "../agents-sdk/SubagentRunDetails.js";
8
- import { t as ThinkChat } from "../../ThinkChat-DQh59CeC.js";
8
+ import { t as ThinkChat } from "../../ThinkChat-DkA4Wr71.js";
9
9
  import * as React from "react";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  import { useAgentChat } from "@cloudflare/think/react";
@@ -61,8 +61,73 @@
61
61
  overflow-wrap: anywhere;
62
62
  }
63
63
 
64
+ .artifact-preview {
65
+ container-type: inline-size;
66
+ min-inline-size: 0;
67
+ border: var(--sigvelo-border-style) var(--sigvelo-border-width)
68
+ var(--sigvelo-color-neutral-border-subtle);
69
+ background: var(--sigvelo-color-surface);
70
+ box-shadow: none;
71
+ }
72
+
73
+ .artifact-preview__header {
74
+ min-inline-size: 0;
75
+ justify-content: flex-end;
76
+ padding-block: var(--sigvelo-spacing-1);
77
+ padding-inline: var(--sigvelo-spacing-2);
78
+ border-block-end: var(--sigvelo-border-style) var(--sigvelo-border-width)
79
+ var(--sigvelo-color-neutral-border-subtle);
80
+ }
81
+
82
+ .artifact-preview__frame-shell {
83
+ position: relative;
84
+ min-inline-size: 0;
85
+ padding: 0;
86
+ }
87
+
88
+ .artifact-preview__runtime {
89
+ min-inline-size: 0;
90
+ }
91
+
92
+ .artifact-preview__runtime > iframe {
93
+ display: block;
94
+ inline-size: 100%;
95
+ min-block-size: 12rem;
96
+ border: 0;
97
+ background: transparent;
98
+ }
99
+
100
+ .artifact-preview__status {
101
+ display: flex;
102
+ min-block-size: 12rem;
103
+ align-items: center;
104
+ justify-content: center;
105
+ flex-wrap: wrap;
106
+ gap: var(--sigvelo-spacing-2);
107
+ padding: var(--sigvelo-spacing-4);
108
+ color: var(--sigvelo-color-text-muted);
109
+ text-align: center;
110
+ }
111
+
112
+ .artifact-preview__status--overlay {
113
+ position: absolute;
114
+ inset: 0;
115
+ color: var(--sigvelo-color-text);
116
+ background: color-mix(in srgb, var(--sigvelo-color-surface) 92%, transparent);
117
+ }
118
+
119
+ @media (any-pointer: coarse) {
120
+ .artifact-preview .button {
121
+ min-block-size: var(--sigvelo-control-height-xl);
122
+ }
123
+ }
124
+
64
125
  @media (forced-colors: active) {
65
126
  .artifact {
66
127
  border: var(--sigvelo-border-style) var(--sigvelo-border-width) CanvasText;
67
128
  }
129
+
130
+ .artifact-preview__header {
131
+ border-color: CanvasText;
132
+ }
68
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-b/react-components",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "description": "MCP-B React components built on Base UI and shared design tokens, including Cloudflare Think chat primitives.",
5
5
  "homepage": "https://design-system.sigvelo.com",
6
6
  "bugs": {
@@ -53,7 +53,7 @@
53
53
  "streamdown": "^2.5.0",
54
54
  "unist-util-visit": "^5.1.0",
55
55
  "yet-another-react-lightbox": "^3.32.1",
56
- "@mcp-b/design-tokens": "0.37.0"
56
+ "@mcp-b/design-tokens": "0.38.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@ai-sdk/react": "^3.0.230",