@mcp-b/react-components 0.14.2 → 0.16.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 (234) hide show
  1. package/dist/AgentActivity-BNUNrP9O.d.ts +36 -0
  2. package/dist/{AgentChat-DQkqt82e.d.ts → AgentChat-CrlpbvQJ.d.ts} +58 -6
  3. package/dist/{CodeBlock-DUh9WOGo.d.ts → CodeBlock-BRajW4QU.d.ts} +1 -1
  4. package/dist/{CodeBlock-BUFXG8HW.js → CodeBlock-BmB4Xaqq.js} +15 -4
  5. package/dist/{FileTree-mpEIcfzA.js → FileTree-CkVbIMWV.js} +82 -89
  6. package/dist/Message-BkMdE3bS.js +375 -0
  7. package/dist/{ModelSelector-CPCpFAUt.js → ModelSelector-SlJNgwKY.js} +2 -2
  8. package/dist/{PromptInput-ClNqBiIw.d.ts → PromptInput-BWTuXMOD.d.ts} +123 -5
  9. package/dist/ResponsiveSidebarShell-Dd9DCcBT.d.ts +67 -0
  10. package/dist/{Select-Dl_vF_Bt.d.ts → Select-BeEsefzh.d.ts} +12 -2
  11. package/dist/{ThinkChat-BPcehdbP.js → ThinkChat-CzC-zNGA.js} +24 -36
  12. package/dist/{ThinkChatActivity-BmwuIigx.d.ts → ThinkChatActivity-BFQnb2ct.d.ts} +3 -10
  13. package/dist/ThinkChatActivitySummary-BPmu9a-c.d.ts +39 -0
  14. package/dist/{ThinkChatToolParts-CDEjqS6A.d.ts → ThinkChatToolParts-CSzVwMXf.d.ts} +13 -3
  15. package/dist/ThinkExecutionRun-ChhWhOoU.d.ts +30 -0
  16. package/dist/Toggle-CAAlNl-M.d.ts +69 -0
  17. package/dist/ToggleGroup-8hPv-b69.d.ts +73 -0
  18. package/dist/Workspace-D39LxGvP.d.ts +62 -0
  19. package/dist/WorkspaceFile-DOZkPwzu.d.ts +106 -0
  20. package/dist/WorkspaceFileView-rSN_yT0L.js +744 -0
  21. package/dist/WorkspaceLink-DIPbXrUM.js +337 -0
  22. package/dist/WorkspaceLink-DK1DWMHe.d.ts +89 -0
  23. package/dist/components/Activity.d.ts +27 -1
  24. package/dist/components/Activity.js +33 -15
  25. package/dist/components/AgentActivity.d.ts +2 -0
  26. package/dist/components/AgentActivity.js +45 -0
  27. package/dist/components/AgentActivityPreview.d.ts +46 -0
  28. package/dist/components/AgentActivityPreview.js +94 -0
  29. package/dist/components/AgentAttention.d.ts +73 -0
  30. package/dist/components/AgentAttention.js +85 -0
  31. package/dist/components/AgentChat.d.ts +2 -2
  32. package/dist/components/AgentChat.js +224 -200
  33. package/dist/components/AgentChatMessageEditor.d.ts +29 -0
  34. package/dist/components/AgentChatMessageEditor.js +92 -0
  35. package/dist/components/AgentChatTurnError.d.ts +17 -0
  36. package/dist/components/AgentChatTurnError.js +40 -0
  37. package/dist/components/AgentConnection.d.ts +12 -17
  38. package/dist/components/AgentConnection.js +99 -91
  39. package/dist/components/AppFrame.d.ts +24 -0
  40. package/dist/components/AppFrame.js +25 -0
  41. package/dist/components/AppTopBar.d.ts +71 -0
  42. package/dist/components/AppTopBar.js +82 -0
  43. package/dist/components/Artifact.js +1 -1
  44. package/dist/components/BrowserLiveView.js +1 -1
  45. package/dist/components/BrowserReplay.js +1 -1
  46. package/dist/components/BrowserRunPanel.js +1 -1
  47. package/dist/components/Card.d.ts +3 -0
  48. package/dist/components/Card.js +2 -1
  49. package/dist/components/ChainOfThought.d.ts +1 -1
  50. package/dist/components/ChainOfThought.js +1 -1
  51. package/dist/components/ChatGptSignInScreen.js +2 -2
  52. package/dist/components/Checkbox.js +5 -13
  53. package/dist/components/CheckboxGroup.d.ts +58 -2
  54. package/dist/components/CheckboxGroup.js +59 -1
  55. package/dist/components/CodeBlock.d.ts +1 -1
  56. package/dist/components/CodeBlock.js +1 -1
  57. package/dist/components/CodexModelSelector.js +1 -1
  58. package/dist/components/Commit.js +2 -2
  59. package/dist/components/ContextMenu.js +1 -1
  60. package/dist/components/Conversation.js +1 -1
  61. package/dist/components/DescriptionList.d.ts +12 -0
  62. package/dist/components/DescriptionList.js +11 -0
  63. package/dist/components/DescriptionListParts.d.ts +37 -0
  64. package/dist/components/DescriptionListParts.js +35 -0
  65. package/dist/components/EnvironmentVariables.js +2 -2
  66. package/dist/components/Fieldset.d.ts +13 -1
  67. package/dist/components/Fieldset.js +11 -2
  68. package/dist/components/FileTree.js +1 -1
  69. package/dist/components/IconButton.d.ts +33 -0
  70. package/dist/components/IconButton.js +27 -0
  71. package/dist/components/McpConnectionRequest.d.ts +44 -0
  72. package/dist/components/McpConnectionRequest.js +122 -0
  73. package/dist/components/McpServerPicker.d.ts +48 -23
  74. package/dist/components/McpServerPicker.js +238 -189
  75. package/dist/components/Menubar.js +1 -1
  76. package/dist/components/Message.d.ts +1 -0
  77. package/dist/components/Message.js +1 -285
  78. package/dist/components/MessageScroller.js +1 -1
  79. package/dist/components/ModelSelector.js +1 -1
  80. package/dist/components/Pricing.d.ts +37 -0
  81. package/dist/components/Pricing.js +17 -0
  82. package/dist/components/PricingBillingToggle.d.ts +23 -0
  83. package/dist/components/PricingBillingToggle.js +86 -0
  84. package/dist/components/PricingConfirmationDialog.d.ts +25 -0
  85. package/dist/components/PricingConfirmationDialog.js +57 -0
  86. package/dist/components/PricingFAQ.d.ts +18 -0
  87. package/dist/components/PricingFAQ.js +27 -0
  88. package/dist/components/PricingPage.d.ts +2 -38
  89. package/dist/components/PricingPage.js +39 -359
  90. package/dist/components/PricingPlanCard.d.ts +22 -0
  91. package/dist/components/PricingPlanCard.js +109 -0
  92. package/dist/components/PricingUsageCalculator.d.ts +22 -0
  93. package/dist/components/PricingUsageCalculator.js +96 -0
  94. package/dist/components/PromptInput.d.ts +2 -2
  95. package/dist/components/PromptInput.js +210 -15
  96. package/dist/components/Queue.js +1 -1
  97. package/dist/components/Reasoning.d.ts +2 -1
  98. package/dist/components/Reasoning.js +14 -29
  99. package/dist/components/ResizableSidePanel.d.ts +57 -0
  100. package/dist/components/ResizableSidePanel.js +151 -0
  101. package/dist/components/ResponsiveSidebarShell.d.ts +2 -0
  102. package/dist/components/ResponsiveSidebarShell.js +129 -0
  103. package/dist/components/Select.d.ts +2 -2
  104. package/dist/components/Select.js +11 -2
  105. package/dist/components/Slider.d.ts +13 -1
  106. package/dist/components/Slider.js +11 -0
  107. package/dist/components/Sources.js +1 -1
  108. package/dist/components/Stepper.d.ts +4 -0
  109. package/dist/components/Stepper.js +5 -3
  110. package/dist/components/SubagentRun.d.ts +18 -19
  111. package/dist/components/SubagentRun.js +25 -18
  112. package/dist/components/SubagentRunIndicator.d.ts +22 -0
  113. package/dist/components/SubagentRunIndicator.js +33 -0
  114. package/dist/components/SubagentRunList.d.ts +25 -0
  115. package/dist/components/SubagentRunList.js +26 -0
  116. package/dist/components/SubagentRunSelector.d.ts +47 -0
  117. package/dist/components/SubagentRunSelector.js +55 -0
  118. package/dist/components/Task.js +1 -1
  119. package/dist/components/Terminal.js +2 -2
  120. package/dist/components/TestResults.js +1 -1
  121. package/dist/components/Textarea.d.ts +21 -0
  122. package/dist/components/Textarea.js +19 -0
  123. package/dist/components/ThemeModeControl.d.ts +24 -0
  124. package/dist/components/ThemeModeControl.js +52 -0
  125. package/dist/components/ThemeProvider.d.ts +38 -0
  126. package/dist/components/ThemeProvider.js +80 -0
  127. package/dist/components/ThinkChat.d.ts +29 -6
  128. package/dist/components/ThinkChat.js +7 -4
  129. package/dist/components/ThinkChatActivity.d.ts +3 -2
  130. package/dist/components/ThinkChatActivity.js +12 -318
  131. package/dist/components/ThinkChatActivitySummary.d.ts +2 -0
  132. package/dist/components/ThinkChatActivitySummary.js +421 -0
  133. package/dist/components/ThinkChatToolPanels.d.ts +7 -5
  134. package/dist/components/ThinkChatToolPanels.js +70 -8
  135. package/dist/components/ThinkChatToolParts.d.ts +2 -2
  136. package/dist/components/ThinkChatToolParts.js +36 -10
  137. package/dist/components/ThinkExecutionDetail.d.ts +20 -0
  138. package/dist/components/ThinkExecutionDetail.js +80 -0
  139. package/dist/components/ThinkExecutionRun.d.ts +2 -0
  140. package/dist/components/ThinkExecutionRun.js +72 -0
  141. package/dist/components/ThinkExecutionStatus.d.ts +22 -0
  142. package/dist/components/ThinkExecutionStatus.js +36 -0
  143. package/dist/components/ThinkExecutionWorkbench.d.ts +7 -0
  144. package/dist/components/ThinkExecutionWorkbench.js +69 -225
  145. package/dist/components/ThinkFullApp.d.ts +58 -14
  146. package/dist/components/ThinkFullApp.js +129 -160
  147. package/dist/components/ThinkFullAppViewSwitch.d.ts +31 -0
  148. package/dist/components/ThinkFullAppViewSwitch.js +34 -0
  149. package/dist/components/ThinkRoutine.d.ts +36 -0
  150. package/dist/components/ThinkRoutine.js +15 -0
  151. package/dist/components/ThinkRoutineBrowser.d.ts +25 -0
  152. package/dist/components/ThinkRoutineBrowser.js +156 -0
  153. package/dist/components/ThinkRoutineDetail.d.ts +24 -0
  154. package/dist/components/ThinkRoutineDetail.js +102 -0
  155. package/dist/components/ThinkRoutineForm.d.ts +32 -0
  156. package/dist/components/ThinkRoutineForm.js +151 -0
  157. package/dist/components/ThinkRoutineLibrary.d.ts +74 -0
  158. package/dist/components/ThinkRoutineLibrary.js +178 -0
  159. package/dist/components/ThinkRoutineRuns.d.ts +24 -0
  160. package/dist/components/ThinkRoutineRuns.js +68 -0
  161. package/dist/components/ThinkThreadPicker.d.ts +18 -1
  162. package/dist/components/ThinkThreadPicker.js +51 -5
  163. package/dist/components/ThinkThreadShell.d.ts +12 -9
  164. package/dist/components/ThinkThreadShell.js +17 -137
  165. package/dist/components/Toggle.d.ts +1 -68
  166. package/dist/components/ToggleGroup.d.ts +1 -72
  167. package/dist/components/Tooltip.d.ts +3 -1
  168. package/dist/components/Tooltip.js +4 -2
  169. package/dist/components/WebPreview.js +1 -1
  170. package/dist/components/Workspace.d.ts +2 -0
  171. package/dist/components/Workspace.js +424 -0
  172. package/dist/components/WorkspaceBrowser.d.ts +32 -0
  173. package/dist/components/WorkspaceBrowser.js +103 -0
  174. package/dist/components/WorkspaceExplorer.d.ts +12 -79
  175. package/dist/components/WorkspaceExplorer.js +116 -330
  176. package/dist/components/WorkspaceFile.d.ts +2 -0
  177. package/dist/components/WorkspaceFile.js +195 -0
  178. package/dist/components/WorkspaceFileView.d.ts +26 -0
  179. package/dist/components/WorkspaceFileView.js +2 -0
  180. package/dist/components/WorkspaceHeader.d.ts +35 -0
  181. package/dist/components/WorkspaceHeader.js +51 -0
  182. package/dist/components/WorkspaceLink.d.ts +2 -0
  183. package/dist/components/WorkspaceLink.js +2 -0
  184. package/dist/components/icons.d.ts +2 -2
  185. package/dist/components/icons.js +2 -2
  186. package/dist/{copy-button-DUMLYdsk.js → copy-button-Dejn5heL.js} +1 -1
  187. package/dist/icons-CpfUer49.js +85 -0
  188. package/dist/{icons-CUCz_Sft.d.ts → icons-GQd1xF4e.d.ts} +51 -1
  189. package/dist/styles/activity-header.css +75 -0
  190. package/dist/styles/activity.css +49 -63
  191. package/dist/styles/agent-activity-preview-overlay.css +80 -0
  192. package/dist/styles/agent-activity-preview.css +235 -0
  193. package/dist/styles/agent-attention.css +122 -0
  194. package/dist/styles/agent-chat.css +133 -4
  195. package/dist/styles/app-frame.css +15 -0
  196. package/dist/styles/app-top-bar.css +100 -0
  197. package/dist/styles/avatar.css +0 -1
  198. package/dist/styles/browser-control-overlay.css +184 -0
  199. package/dist/styles/card.css +21 -0
  200. package/dist/styles/checkbox-group.css +69 -0
  201. package/dist/styles/description-list.css +50 -0
  202. package/dist/styles/fieldset.css +11 -0
  203. package/dist/styles/index.css +14 -2
  204. package/dist/styles/mcp-connection-request.css +60 -0
  205. package/dist/styles/mcp-server-picker.css +95 -68
  206. package/dist/styles/message.css +4 -43
  207. package/dist/styles/pricing-page.css +21 -27
  208. package/dist/styles/prompt-input.css +225 -32
  209. package/dist/styles/reasoning.css +1 -55
  210. package/dist/styles/recipes.css +23 -15
  211. package/dist/styles/resizable-side-panel.css +66 -0
  212. package/dist/styles/responsive-sidebar-shell.css +169 -0
  213. package/dist/styles/select.css +10 -0
  214. package/dist/styles/stepper.css +13 -0
  215. package/dist/styles/streamdown.css +0 -4
  216. package/dist/styles/subagent-run.css +55 -38
  217. package/dist/styles/textarea.css +20 -0
  218. package/dist/styles/theme-mode-control.css +72 -0
  219. package/dist/styles/think-execution-status.css +49 -0
  220. package/dist/styles/think-execution-workbench.css +8 -72
  221. package/dist/styles/think-full-app.css +104 -131
  222. package/dist/styles/think-routine-library.css +491 -0
  223. package/dist/styles/think-thread-picker.css +47 -3
  224. package/dist/styles/toggle-group.css +7 -0
  225. package/dist/styles/workspace-explorer.css +511 -64
  226. package/dist/utils/mcp-server-catalog.d.ts +82 -78
  227. package/dist/utils/mcp-server-catalog.js +64 -41
  228. package/dist/utils/structured-code.d.ts +1 -1
  229. package/dist/utils/theme.d.ts +22 -0
  230. package/dist/utils/theme.js +55 -0
  231. package/package.json +34 -28
  232. package/dist/icons-Ba9THQKz.js +0 -64
  233. package/dist/styles/think-resize-handle.css +0 -33
  234. package/dist/styles/think-thread-shell.css +0 -219
@@ -1,5 +1,5 @@
1
- import { Button } from "./components/Button.js";
2
1
  import { AgentChat } from "./components/AgentChat.js";
2
+ import { AgentChatTurnError } from "./components/AgentChatTurnError.js";
3
3
  import { ThinkChatContext, useThinkChatContext } from "./components/ThinkChatContext.js";
4
4
  import { ThinkChatActivity, createThinkChatActivityRenderer, renderThinkChatActivityPart } from "./components/ThinkChatActivity.js";
5
5
  import * as React from "react";
@@ -142,44 +142,32 @@ function ThinkChatMessages({ renderPart, excludeTools, toolRenderers, thinkStub,
142
142
  excludeTools,
143
143
  toolRenderers
144
144
  }), [excludeTools, toolRenderers]);
145
+ const resolvedRenderPart = React.useMemo(() => renderPart ? (context) => {
146
+ const renderBuiltIn = () => {
147
+ const builtIn = defaultRenderPart(context);
148
+ return builtIn === void 0 ? context.defaultRender() : builtIn;
149
+ };
150
+ const custom = renderPart({
151
+ ...context,
152
+ defaultRender: renderBuiltIn
153
+ });
154
+ return custom === void 0 ? renderBuiltIn() : custom;
155
+ } : defaultRenderPart, [defaultRenderPart, renderPart]);
145
156
  const retryMessageId = chat.error ? chat.messages.findLast((message) => message.role !== "system")?.id : void 0;
146
157
  const defaultNotice = chat.isRecovering ? /* @__PURE__ */ jsx(Fragment, { children: "Reconnecting to the agent…" }) : chat.connectionError ? /* @__PURE__ */ jsxs("span", {
147
158
  "data-tone": "danger",
148
159
  children: ["Connection lost", chat.connectionError.reason ? ` — ${chat.connectionError.reason}` : ""]
149
- }) : chat.error ? /* @__PURE__ */ jsxs("div", {
150
- className: "agent-chat__turn-error",
151
- "data-tone": "danger",
152
- children: [/* @__PURE__ */ jsxs("p", {
153
- className: "agent-chat__turn-error-message",
154
- children: [
155
- /* @__PURE__ */ jsx("strong", { children: "Response failed." }),
156
- " ",
157
- chat.error.message.trim() || "The response could not be completed."
158
- ]
159
- }), /* @__PURE__ */ jsxs("div", {
160
- className: "agent-chat__turn-error-actions",
161
- children: [/* @__PURE__ */ jsx(Button, {
162
- type: "button",
163
- variant: "ghost",
164
- color: "neutral",
165
- size: "lg",
166
- onClick: chat.clearError,
167
- children: "Dismiss"
168
- }), retryMessageId ? /* @__PURE__ */ jsx(Button, {
169
- type: "button",
170
- color: "primary",
171
- size: "lg",
172
- onClick: () => {
173
- chat.clearError();
174
- chat.regenerate({ messageId: retryMessageId });
175
- },
176
- children: "Try again"
177
- }) : null]
178
- })]
160
+ }) : chat.error ? /* @__PURE__ */ jsx(AgentChatTurnError, {
161
+ error: chat.error,
162
+ onDismiss: chat.clearError,
163
+ onRetry: retryMessageId ? () => {
164
+ chat.clearError();
165
+ chat.regenerate({ messageId: retryMessageId });
166
+ } : void 0
179
167
  }) : void 0;
180
168
  return /* @__PURE__ */ jsx(AgentChat, {
181
169
  ...props,
182
- renderPart: renderPart ?? defaultRenderPart,
170
+ renderPart: resolvedRenderPart,
183
171
  messages: chat.messages,
184
172
  status,
185
173
  onStop: chat.stop,
@@ -189,10 +177,10 @@ function ThinkChatMessages({ renderPart, excludeTools, toolRenderers, thinkStub,
189
177
  pendingApprovals: resolvedApprovals.pendingApprovals,
190
178
  notice: notice ?? defaultNotice,
191
179
  onRegenerate: (messageId) => void chat.regenerate({ messageId }),
192
- onSubmit: ({ text, files }) => {
193
- const trimmed = text.trim();
194
- if (trimmed || files.length) chat.sendMessage({
195
- text: trimmed,
180
+ onSubmit: ({ text, files, references }) => {
181
+ const prompt = [...references?.map(({ trigger, value }) => trigger ? `${trigger}${value}` : value) ?? [], text.trim()].filter(Boolean).join(" ");
182
+ if (prompt || files.length) return chat.sendMessage({
183
+ text: prompt,
196
184
  files
197
185
  });
198
186
  }
@@ -1,5 +1,5 @@
1
- import { a as AgentChatRenderPartContext, r as AgentChatProps } from "./AgentChat-DQkqt82e.js";
2
- import { l as ThinkChatPart } from "./ThinkChatToolParts-CDEjqS6A.js";
1
+ import { i as AgentChatProps, o as AgentChatRenderPartContext } from "./AgentChat-CrlpbvQJ.js";
2
+ import { l as ThinkChatPart } from "./ThinkChatToolParts-CSzVwMXf.js";
3
3
  import * as React from "react";
4
4
  import { DynamicToolUIPart, ToolUIPart, UIMessage } from "ai";
5
5
 
@@ -27,13 +27,6 @@ interface ThinkChatActivityRendererOptions {
27
27
  /** Per-tool label/panel overrides inside the activity log, keyed by tool name. */
28
28
  toolRenderers?: ThinkChatToolRenderers;
29
29
  }
30
- /**
31
- * One-line natural-language label for an activity part ("Ran vp test",
32
- * "Fetched developers.cloudflare.com/agents/"); `null` for boundaries that
33
- * aren't steps (step-start). Exported so a custom `renderPart` can reuse the
34
- * built-in labels for tools it doesn't override.
35
- */
36
- declare function describeThinkChatActivityPart(part: ThinkChatPart, toolRenderers?: ThinkChatToolRenderers): string | null;
37
30
  interface ThinkChatActivityProps {
38
31
  /** Render with the log expanded. */
39
32
  defaultOpen?: boolean;
@@ -70,4 +63,4 @@ declare function createThinkChatActivityRenderer<MessageT extends UIMessage = UI
70
63
  /** Default activity renderer — `createThinkChatActivityRenderer()` with no overrides. */
71
64
  declare const renderThinkChatActivityPart: (context: AgentChatRenderPartContext<UIMessage<unknown, import("ai").UIDataTypes, import("ai").UITools>>) => React.ReactNode | undefined;
72
65
  //#endregion
73
- export { ThinkChatToolRenderers as a, renderThinkChatActivityPart as c, ThinkChatToolRenderer as i, ThinkChatActivityProps as n, createThinkChatActivityRenderer as o, ThinkChatActivityRendererOptions as r, describeThinkChatActivityPart as s, ThinkChatActivity as t };
66
+ export { ThinkChatToolRenderers as a, ThinkChatToolRenderer as i, ThinkChatActivityProps as n, createThinkChatActivityRenderer as o, ThinkChatActivityRendererOptions as r, renderThinkChatActivityPart as s, ThinkChatActivity as t };
@@ -0,0 +1,39 @@
1
+ import { i as AgentActivityIconKind, s as AgentActivitySummary } from "./AgentActivity-BNUNrP9O.js";
2
+ import { l as ThinkChatPart } from "./ThinkChatToolParts-CSzVwMXf.js";
3
+ import { DynamicToolUIPart, ToolUIPart } from "ai";
4
+
5
+ //#region src/components/ThinkChatActivitySummary.d.ts
6
+ interface ThinkChatToolDescriber {
7
+ describe?: (part: ToolUIPart | DynamicToolUIPart) => string | null | undefined;
8
+ }
9
+ type ThinkChatToolDescribers = Record<string, ThinkChatToolDescriber>;
10
+ type ThinkChatActivityHeader = Omit<AgentActivitySummary, "mode">;
11
+ declare function activityPartUrl(part: ThinkChatPart): string | null;
12
+ declare function activityPartIconKind(part: ThinkChatPart): AgentActivityIconKind;
13
+ /**
14
+ * One-line natural-language label for an activity part ("Ran vp test",
15
+ * "Fetched developers.cloudflare.com/agents/"); `null` for boundaries that
16
+ * aren't steps (step-start). Exported so a custom `renderPart` can reuse the
17
+ * built-in labels for tools it doesn't override.
18
+ */
19
+ declare function describeThinkChatActivityPart(part: ThinkChatPart, toolRenderers?: ThinkChatToolDescribers): string | null;
20
+ declare function summarizeActivitySteps(parts: readonly ThinkChatPart[]): string;
21
+ interface ThinkChatToolLifecycleSnapshot {
22
+ toolName: string;
23
+ input?: unknown;
24
+ state: "working" | "succeeded" | "failed" | "approval-required";
25
+ output?: unknown;
26
+ error?: unknown;
27
+ }
28
+ /** Derive the serializable collapsed header from persisted AI SDK message parts. */
29
+ declare function deriveThinkChatActivityHeader(parts: readonly ThinkChatPart[], options?: {
30
+ isStreaming?: boolean;
31
+ toolDescribers?: ThinkChatToolDescribers;
32
+ }): ThinkChatActivityHeader | null;
33
+ /**
34
+ * Derive the same live header from a host lifecycle event without making the
35
+ * host manufacture an AI SDK UI message part.
36
+ */
37
+ declare function deriveThinkChatToolLifecycleHeader(snapshot: ThinkChatToolLifecycleSnapshot): ThinkChatActivityHeader;
38
+ //#endregion
39
+ export { activityPartIconKind as a, deriveThinkChatToolLifecycleHeader as c, ThinkChatToolLifecycleSnapshot as i, describeThinkChatActivityPart as l, ThinkChatToolDescriber as n, activityPartUrl as o, ThinkChatToolDescribers as r, deriveThinkChatActivityHeader as s, ThinkChatActivityHeader as t, summarizeActivitySteps as u };
@@ -1,4 +1,4 @@
1
- import { InferUITools, ToolUIPart, UIMessage } from "ai";
1
+ import { DynamicToolUIPart, InferUITools, ToolUIPart, UIMessage } from "ai";
2
2
  import { ProxyToolInput, ProxyToolOutput } from "@cloudflare/codemode";
3
3
  import { QuickActionExtractInput, QuickActionPage, QuickActionScrapeInput, QuickActionToolName } from "@cloudflare/think/tools/browser";
4
4
  import { FetchResponseMode, FetchResult } from "@cloudflare/think/tools/fetch";
@@ -6,6 +6,16 @@ import { WorkspaceTools } from "@cloudflare/think/tools/workspace";
6
6
 
7
7
  //#region src/components/ThinkChatToolParts.d.ts
8
8
  type ThinkChatPart = UIMessage["parts"][number];
9
+ type AnyToolUIPart = ToolUIPart | DynamicToolUIPart;
10
+ /** Prefer AI SDK's provider/tool-authored title over its transport-facing key. */
11
+ declare function getToolDisplayName(part: AnyToolUIPart): string;
12
+ /**
13
+ * Whole-part supplement to Think's simplified state mapping. Think maps every
14
+ * `output-available` part to complete, while AI SDK preliminary outputs remain
15
+ * in flight until a non-preliminary result arrives.
16
+ */
17
+ declare function isToolPartWorking(part: AnyToolUIPart): boolean;
18
+ declare function isToolPartFailed(part: AnyToolUIPart): boolean;
9
19
  type WorkspaceUITools = InferUITools<Required<WorkspaceTools>>;
10
20
  type WorkspaceToolPart = ToolUIPart<WorkspaceUITools>;
11
21
  type ThinkWorkspaceToolName = keyof WorkspaceUITools;
@@ -131,10 +141,10 @@ type ExecuteToolPart = ToolUIPart<{
131
141
  declare function isExecuteToolPart(part: ThinkChatPart): part is ExecuteToolPart;
132
142
  /** Agent work (reasoning, tool calls, step boundaries) vs. content shown to the user. */
133
143
  declare function isThinkChatActivityPart(part: ThinkChatPart | undefined, excludeTools?: ReadonlySet<string>): boolean;
134
- /** In-flight: the stream opened this part but hasn't delivered its result yet. */
144
+ /** In-flight: awaiting input, approval continuation, or a final tool result. */
135
145
  declare function isPartWorking(part: ThinkChatPart): boolean;
136
146
  /** Errored or denied — upstream's simplified tool-part state vocabulary. */
137
147
  declare function isPartFailed(part: ThinkChatPart): boolean;
138
148
  declare function displayUrl(url: string | undefined): string;
139
149
  //#endregion
140
- export { isWorkspaceToolPart as S, isPartWorking as _, SessionContextToolPart as a, isSkillToolPart as b, ThinkBashToolPart as c, WorkspaceToolPart as d, displayUrl as f, isPartFailed as g, isFetchToolPart as h, SessionContextToolName as i, ThinkChatPart as l, isExecuteToolPart as m, ExecuteToolPart as n, SkillToolPart as o, isBrowserToolPart as p, FetchToolPart as r, ThinkBashToolOutput as s, BrowserToolPart as t, ThinkWorkspaceToolName as u, isSessionContextToolFailure as v, isThinkChatActivityPart as x, isSessionContextToolPart as y };
150
+ export { isToolPartFailed as C, isThinkChatActivityPart as S, isWorkspaceToolPart as T, isPartFailed as _, SessionContextToolPart as a, isSessionContextToolPart as b, ThinkBashToolPart as c, WorkspaceToolPart as d, displayUrl as f, isFetchToolPart as g, isExecuteToolPart as h, SessionContextToolName as i, ThinkChatPart as l, isBrowserToolPart as m, ExecuteToolPart as n, SkillToolPart as o, getToolDisplayName as p, FetchToolPart as r, ThinkBashToolOutput as s, BrowserToolPart as t, ThinkWorkspaceToolName as u, isPartWorking as v, isToolPartWorking as w, isSkillToolPart as x, isSessionContextToolFailure as y };
@@ -0,0 +1,30 @@
1
+ import { ThinkSubmissionInspection } from "@cloudflare/think";
2
+ import { WorkflowInfo } from "agents/workflows";
3
+
4
+ //#region src/components/ThinkExecutionRun.d.ts
5
+ /** Whole upstream execution records displayed by Think routine and execution surfaces. */
6
+ type ThinkExecutionRun = ThinkSubmissionInspection | WorkflowInfo;
7
+ /** Narrows the direct upstream execution union without wrapping either record. */
8
+ declare function isThinkSubmissionRun(run: ThinkExecutionRun): run is ThinkSubmissionInspection;
9
+ type ThinkExecutionStatusTone = "success" | "danger" | "warning" | "primary" | "neutral";
10
+ declare function getThinkExecutionRunId(run: ThinkExecutionRun): string;
11
+ declare function getThinkExecutionRunTitle(run: ThinkExecutionRun): string;
12
+ declare function getThinkExecutionRunSubtitle(run: ThinkExecutionRun): string | undefined;
13
+ declare function getThinkExecutionRunProgressedAt(run: ThinkExecutionRun): number | Date | undefined;
14
+ declare function getThinkExecutionRunProgressedLabel(run: ThinkExecutionRun): "Started" | "Updated";
15
+ /**
16
+ * WorkflowInfo.status resolves through the Workers-only InstanceStatus ambient
17
+ * type, so browser consumers format the whole upstream record's runtime value
18
+ * instead of exporting a local mirror of that union.
19
+ */
20
+ declare function getThinkExecutionRunStatus(run: ThinkExecutionRun): string;
21
+ declare function getThinkExecutionRunStatusTone(run: ThinkExecutionRun): ThinkExecutionStatusTone;
22
+ declare function formatThinkExecutionStatus(status: string): string;
23
+ declare function formatThinkExecutionTimestamp(value: Date | number | null | undefined, fallback?: string): string;
24
+ declare function formatThinkExecutionShortTimestamp(value: Date | number | null | undefined, fallback?: string): string;
25
+ declare function formatThinkExecutionRunProgress(run: ThinkExecutionRun): string;
26
+ declare function getThinkExecutionRunAccessibleName(run: ThinkExecutionRun): string;
27
+ declare function getThinkExecutionRunError(run: ThinkExecutionRun): string | undefined;
28
+ declare function isSameThinkExecutionRun(first: ThinkExecutionRun | null, second: ThinkExecutionRun): boolean;
29
+ //#endregion
30
+ export { isThinkSubmissionRun as _, formatThinkExecutionStatus as a, getThinkExecutionRunError as c, getThinkExecutionRunProgressedLabel as d, getThinkExecutionRunStatus as f, isSameThinkExecutionRun as g, getThinkExecutionRunTitle as h, formatThinkExecutionShortTimestamp as i, getThinkExecutionRunId as l, getThinkExecutionRunSubtitle as m, ThinkExecutionStatusTone as n, formatThinkExecutionTimestamp as o, getThinkExecutionRunStatusTone as p, formatThinkExecutionRunProgress as r, getThinkExecutionRunAccessibleName as s, ThinkExecutionRun as t, getThinkExecutionRunProgressedAt as u };
@@ -0,0 +1,69 @@
1
+ import * as React from "react";
2
+ import { Toggle } from "@base-ui/react/toggle";
3
+
4
+ //#region src/components/Toggle.d.ts
5
+ interface ToggleVariantsOptions {
6
+ variant?: "default" | "outline" | null;
7
+ size?: "default" | "sm" | "lg" | null;
8
+ className?: string;
9
+ }
10
+ /**
11
+ * Props for the Toggle component.
12
+ */
13
+ interface ToggleProps extends Omit<React.ComponentPropsWithoutRef<typeof Toggle>, "className">, ToggleVariantsOptions {}
14
+ declare function toggleVariants({
15
+ variant,
16
+ size,
17
+ className
18
+ }?: ToggleVariantsOptions): string;
19
+ /**
20
+ * A two-state button that can be on (pressed) or off.
21
+ * Useful for toggling a setting or mode.
22
+ *
23
+ * @example
24
+ * ```tsx
25
+ * // Basic toggle
26
+ * <Toggle>
27
+ * Bold
28
+ * </Toggle>
29
+ * ```
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * // Controlled toggle
34
+ * const [pressed, setPressed] = useState(false);
35
+ *
36
+ * <Toggle pressed={pressed} onPressedChange={setPressed}>
37
+ * {pressed ? 'On' : 'Off'}
38
+ * </Toggle>
39
+ * ```
40
+ *
41
+ * @example
42
+ * ```tsx
43
+ * // With icons
44
+ * <Toggle>
45
+ * {({ pressed }) => pressed ? <BoldIcon filled /> : <BoldIcon />}
46
+ * </Toggle>
47
+ * ```
48
+ *
49
+ * @example
50
+ * ```tsx
51
+ * // Default pressed state
52
+ * <Toggle defaultPressed>
53
+ * Enabled
54
+ * </Toggle>
55
+ * ```
56
+ *
57
+ * @see {@link https://base-ui.com/react/components/toggle | Base UI Toggle}
58
+ */
59
+ declare function Toggle$1({
60
+ className,
61
+ variant,
62
+ size,
63
+ ref,
64
+ ...props
65
+ }: ToggleProps & {
66
+ ref?: React.Ref<HTMLButtonElement>;
67
+ }): React.JSX.Element;
68
+ //#endregion
69
+ export { toggleVariants as i, ToggleProps as n, ToggleVariantsOptions as r, Toggle$1 as t };
@@ -0,0 +1,73 @@
1
+ import { r as ToggleVariantsOptions } from "./Toggle-CAAlNl-M.js";
2
+ import * as React from "react";
3
+ import { ToggleGroup } from "@base-ui/react/toggle-group";
4
+ import { Toggle } from "@base-ui/react/toggle";
5
+
6
+ //#region src/components/ToggleGroup.d.ts
7
+ type ToggleGroupSize = ToggleVariantsOptions["size"] | "md";
8
+ interface ToggleGroupProps extends Omit<React.ComponentPropsWithRef<typeof ToggleGroup>, "className"> {
9
+ className?: string;
10
+ variant?: ToggleVariantsOptions["variant"];
11
+ /**
12
+ * The size of the toggle group.
13
+ * @default 'md'
14
+ */
15
+ size?: ToggleGroupSize;
16
+ spacing?: number;
17
+ }
18
+ interface ToggleGroupItemProps extends Omit<React.ComponentPropsWithRef<typeof Toggle>, "className">, ToggleVariantsOptions {}
19
+ /**
20
+ * A toggle group component for selecting one or multiple options.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * // Single selection (defaultValue is an array)
25
+ * <ToggleGroup defaultValue={["center"]}>
26
+ * <ToggleGroupItem value="left">Left</ToggleGroupItem>
27
+ * <ToggleGroupItem value="center">Center</ToggleGroupItem>
28
+ * <ToggleGroupItem value="right">Right</ToggleGroupItem>
29
+ * </ToggleGroup>
30
+ * ```
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * // Multiple selection
35
+ * <ToggleGroup multiple defaultValue={["bold", "italic"]}>
36
+ * <ToggleGroupItem value="bold">Bold</ToggleGroupItem>
37
+ * <ToggleGroupItem value="italic">Italic</ToggleGroupItem>
38
+ * <ToggleGroupItem value="underline">Underline</ToggleGroupItem>
39
+ * </ToggleGroup>
40
+ * ```
41
+ *
42
+ * @see {@link https://base-ui.com/react/components/toggle-group | Base UI Toggle Group}
43
+ */
44
+ declare function ToggleGroupRoot({
45
+ size,
46
+ spacing,
47
+ variant,
48
+ className,
49
+ children,
50
+ style,
51
+ ref,
52
+ ...props
53
+ }: ToggleGroupProps & {
54
+ ref?: React.Ref<HTMLDivElement>;
55
+ }): React.JSX.Element;
56
+ /**
57
+ * A single toggle item within a ToggleGroup.
58
+ */
59
+ declare function ToggleGroupItem({
60
+ className,
61
+ variant,
62
+ size,
63
+ ref,
64
+ ...props
65
+ }: ToggleGroupItemProps & {
66
+ ref?: React.Ref<HTMLButtonElement>;
67
+ }): React.JSX.Element;
68
+ declare const ToggleGroup$1: {
69
+ Root: typeof ToggleGroupRoot;
70
+ Item: typeof ToggleGroupItem;
71
+ };
72
+ //#endregion
73
+ export { ToggleGroupItemProps as n, ToggleGroupProps as r, ToggleGroup$1 as t };
@@ -0,0 +1,62 @@
1
+ import { i as WorkspaceFileState, r as WorkspaceFileAssetResolver } from "./WorkspaceFile-DOZkPwzu.js";
2
+ import { WorkspaceLike } from "@cloudflare/think";
3
+ import { FileInfo, Workspace } from "@cloudflare/shell";
4
+
5
+ //#region src/components/Workspace.d.ts
6
+ /** Workspace summary, as returned by `Workspace.getWorkspaceInfo()` upstream. */
7
+ type WorkspaceInfo = Awaited<ReturnType<Workspace["getWorkspaceInfo"]>>;
8
+ /** Whole upstream workspace shapes, accepted without narrowing or mirroring. */
9
+ type WorkspaceSource = Workspace | WorkspaceLike;
10
+ interface UseWorkspaceOptions {
11
+ /** Must be referentially stable (memoize in the app) — a new source resets the workspace. */
12
+ source: WorkspaceSource;
13
+ /** Root directory to list first. Defaults to "/". */
14
+ root?: string;
15
+ /**
16
+ * Optional host adapter called before text/binary reads. Return `null` for
17
+ * ordinary text files and prefer signed/range-friendly URLs for large media.
18
+ * The configured root scopes navigation; hosts must enforce authorization
19
+ * atomically when resolving assets across a trust boundary.
20
+ */
21
+ resolveFileAsset?: WorkspaceFileAssetResolver;
22
+ /** Maximum size for the built-in buffered-byte fallback. Defaults to 32 MiB. */
23
+ maxInlineAssetBytes?: number;
24
+ }
25
+ interface WorkspaceState {
26
+ root: string;
27
+ /** Loaded directory listings, keyed by directory path. */
28
+ entriesByDirectory: Readonly<Record<string, readonly FileInfo[]>>;
29
+ /** Every loaded entry, keyed by its path. */
30
+ entryByPath: ReadonlyMap<string, FileInfo>;
31
+ expandedPaths: ReadonlySet<string>;
32
+ /** Update expansion; newly expanded directories load lazily. */
33
+ setExpandedPaths: (next: Set<string>) => void;
34
+ selectedPath: string | null;
35
+ /** Select a file and load it. Text is cached; binary assets remain active-file only. */
36
+ selectFile: (path: string | null) => void;
37
+ /** The selected file once its read settles; null while loading. */
38
+ selectedFile: WorkspaceFileState | null;
39
+ /** Root listing in flight. */
40
+ isLoading: boolean;
41
+ /** Directory and file paths with a request in flight. */
42
+ loadingPaths: ReadonlySet<string>;
43
+ /** Root/directory listing failure. Per-file read errors live on the file state. */
44
+ error: string | null;
45
+ /** Workspace summary, when the source provides `getWorkspaceInfo`. */
46
+ info: WorkspaceInfo | null;
47
+ /** Reload the root, every expanded directory, and the selected file. */
48
+ refresh: () => void;
49
+ }
50
+ /**
51
+ * Headless state for browsing a Think workspace: lazy directory loading,
52
+ * cached file reads, expansion/selection, and refresh. Feed the result to
53
+ * `WorkspaceExplorer`, or compose `WorkspaceBrowser` and `WorkspaceFileView`.
54
+ */
55
+ declare function useWorkspace({
56
+ source,
57
+ root,
58
+ resolveFileAsset,
59
+ maxInlineAssetBytes
60
+ }: UseWorkspaceOptions): WorkspaceState;
61
+ //#endregion
62
+ export { useWorkspace as a, WorkspaceState as i, WorkspaceInfo as n, WorkspaceSource as r, UseWorkspaceOptions as t };
@@ -0,0 +1,106 @@
1
+ import { A as CodeBlockLanguage } from "./CodeBlock-BRajW4QU.js";
2
+ import { SkillParseResult } from "agent-skills-ts-sdk";
3
+ import { FileInfo } from "@cloudflare/shell";
4
+
5
+ //#region src/components/WorkspaceFile.d.ts
6
+ type WorkspaceMediaKind = "image" | "pdf" | "audio" | "video";
7
+ interface WorkspaceMediaInfo {
8
+ kind: WorkspaceMediaKind;
9
+ mimeType: string;
10
+ }
11
+ type WorkspaceMediaTrackKind = "subtitles" | "captions" | "descriptions" | "chapters" | "metadata";
12
+ /** Optional timed text supplied by a host alongside an audio or video asset. */
13
+ interface WorkspaceMediaTrack {
14
+ src: string;
15
+ kind: WorkspaceMediaTrackKind;
16
+ srcLang: string;
17
+ label: string;
18
+ default?: boolean;
19
+ }
20
+ interface WorkspaceFileAssetMetadata {
21
+ mimeType?: string;
22
+ size?: number;
23
+ /** Meaningful image alternative. Empty or omitted values fall back to the file name. */
24
+ alt?: string;
25
+ /** Optional video poster URL. */
26
+ posterUrl?: string;
27
+ /** CORS mode for audio/video and cross-origin timed-text tracks. */
28
+ crossOrigin?: "anonymous" | "use-credentials";
29
+ /** Optional caption, subtitle, description, chapter, or metadata tracks. */
30
+ tracks?: readonly WorkspaceMediaTrack[];
31
+ /** Optional transcript destination shown alongside audio and video previews. */
32
+ transcriptUrl?: string;
33
+ }
34
+ /** A host-owned URL or component-owned buffered data for the active workspace file. */
35
+ type WorkspaceFileAsset = (WorkspaceFileAssetMetadata & {
36
+ kind: "url";
37
+ /**
38
+ * HTTP(S), relative, or blob URL owned by the host. The component never
39
+ * revokes it, so it must remain valid for the preview lifetime. PDF URLs
40
+ * must serve `application/pdf` with `X-Content-Type-Options: nosniff`.
41
+ */
42
+ url: string;
43
+ /**
44
+ * Optional host-owned download destination. Cross-origin endpoints must
45
+ * use `Content-Disposition: attachment`; SVG also requires attachment
46
+ * semantics or an isolated asset origin.
47
+ */
48
+ downloadUrl?: string;
49
+ }) | (WorkspaceFileAssetMetadata & {
50
+ kind: "data"; /** Buffered data whose component-created object URL is revoked on replacement/unmount. */
51
+ data: Blob | ArrayBuffer | Uint8Array;
52
+ });
53
+ interface WorkspaceFileAssetRequest {
54
+ /**
55
+ * Canonical path reported by `source.stat()`. Use this path, not
56
+ * `requestedPath`, when issuing a host-owned asset URL.
57
+ */
58
+ path: string;
59
+ /** Path selected in the explorer. This can name a symlink. */
60
+ requestedPath: string;
61
+ /** Normalized navigation root configured on `useWorkspace`. */
62
+ root: string;
63
+ /** Fresh metadata from `source.stat()`. The resolver is never called without it. */
64
+ info: FileInfo;
65
+ signal: AbortSignal;
66
+ }
67
+ /**
68
+ * Host adapter for signed/range-friendly URLs or custom binary loading.
69
+ * `useWorkspace` performs defense-in-depth path checks, but its `stat()` and
70
+ * read calls are not atomic. Hosts that treat `root` as an authorization
71
+ * boundary must authorize and resolve the asset atomically in this callback
72
+ * (preferably by immutable file identity), then return its URL or bytes.
73
+ */
74
+ type WorkspaceFileAssetResolver = (request: WorkspaceFileAssetRequest) => WorkspaceFileAsset | null | Promise<WorkspaceFileAsset | null>;
75
+ interface WorkspaceFileState {
76
+ path: string;
77
+ name: string;
78
+ /** Text content. Media previews leave this `null` and populate `asset`. */
79
+ content: string | null;
80
+ /** Binary asset for a supported image, PDF, audio, or video file. */
81
+ asset?: WorkspaceFileAsset | null;
82
+ /** Upstream metadata when the file was present in a loaded directory. */
83
+ info?: FileInfo | null;
84
+ error: string | null;
85
+ }
86
+ /** Agent Skills SDK result attached to a workspace `SKILL.md` preview. */
87
+ interface WorkspaceSkillDocument {
88
+ parsed: SkillParseResult | null;
89
+ validationErrors: readonly string[];
90
+ }
91
+ declare function getWorkspaceBasename(path: string): string;
92
+ declare function isWorkspaceMarkdownPath(path: string): boolean;
93
+ declare function isWorkspaceSkillPath(path: string): boolean;
94
+ /**
95
+ * Identify supported browser-native media before reading a file as text.
96
+ * A precise supported MIME wins; extensions provide the fallback for stores
97
+ * that report generic values such as `application/octet-stream`.
98
+ */
99
+ declare function inferWorkspaceMedia(path: string, mimeType?: string | null): WorkspaceMediaInfo | null;
100
+ declare function isWorkspaceMediaPath(path: string, mimeType?: string | null): boolean;
101
+ /** Parse and validate a workspace skill with the canonical Agent Skills SDK. */
102
+ declare function parseWorkspaceSkill(content: string): WorkspaceSkillDocument;
103
+ /** Best-effort syntax-highlighting language from a file path; unknown extensions render as plain text. */
104
+ declare function inferWorkspaceLanguage(path: string): CodeBlockLanguage;
105
+ //#endregion
106
+ export { WorkspaceMediaInfo as a, WorkspaceMediaTrackKind as c, inferWorkspaceLanguage as d, inferWorkspaceMedia as f, parseWorkspaceSkill as g, isWorkspaceSkillPath as h, WorkspaceFileState as i, WorkspaceSkillDocument as l, isWorkspaceMediaPath as m, WorkspaceFileAssetRequest as n, WorkspaceMediaKind as o, isWorkspaceMarkdownPath as p, WorkspaceFileAssetResolver as r, WorkspaceMediaTrack as s, WorkspaceFileAsset as t, getWorkspaceBasename as u };