@mcp-b/react-components 0.17.0 → 0.18.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 (292) hide show
  1. package/dist/{AgentActivity-BNUNrP9O.d.ts → AgentActivity-D2SHSGFX.d.ts} +1 -1
  2. package/dist/{AgentChat-CRuMi1Pb.d.ts → AgentChat-ClxViuUM.d.ts} +1 -20
  3. package/dist/{Button-FX_hpqxm.d.ts → Button-DLGzHsjc.d.ts} +13 -7
  4. package/dist/{CodeBlock-Co1noLbC.js → CodeBlock-Bfp5PAg3.js} +9 -6
  5. package/dist/{CodeBlock-Dnpr88ZQ.d.ts → CodeBlock-gV4kZeCI.d.ts} +2 -9
  6. package/dist/{FileTree-B7bBsUyU.js → FileTree-3zYtrddG.js} +42 -16
  7. package/dist/{Message-C4eYRogZ.js → Message-BXtmfc9Q.js} +13 -20
  8. package/dist/{ModelSelector-BNrZlY_Y.js → ModelSelector-Cqw_qrUG.js} +15 -22
  9. package/dist/{PromptInput-OLfXPuHM.d.ts → PromptInput-Bdh9pqlo.d.ts} +4 -6
  10. package/dist/{Select-CwSqP07Y.d.ts → Select-B_13gg_J.d.ts} +2 -2
  11. package/dist/{Tabs-9zddXDQo.d.ts → Tabs-ColWK-XA.d.ts} +10 -2
  12. package/dist/{ThinkChat-DInElus-.js → ThinkChat-15EhfvYJ.js} +84 -61
  13. package/dist/{ThinkChatActivity-BgesTfZ4.d.ts → ThinkChatActivity-Bzot45kX.d.ts} +4 -7
  14. package/dist/{ThinkChatActivitySummary-BPmu9a-c.d.ts → ThinkChatActivitySummary-D1xOrNrq.d.ts} +1 -1
  15. package/dist/{Toggle-DaXpe1Lc.d.ts → Toggle-JKZ43D5S.d.ts} +1 -1
  16. package/dist/{ToggleGroup-yseEWkOC.d.ts → ToggleGroup-DNd6cDJZ.d.ts} +2 -2
  17. package/dist/Workspace-Jez8ffUj.d.ts +274 -0
  18. package/dist/{WorkspaceExplorer-sZewzT2O.d.ts → WorkspaceExplorer-B9dQWNVK.d.ts} +2 -2
  19. package/dist/{WorkspaceFile-C8UzuSH4.d.ts → WorkspaceFile-CzyHnESE.d.ts} +1 -1
  20. package/dist/{WorkspaceFileView-DNdGAEiX.js → WorkspaceFileView-C68Ub8S8.js} +120 -127
  21. package/dist/{WorkspaceLink-B1ykV1dS.js → WorkspaceLink-BYYeTQLf.js} +6 -27
  22. package/dist/{WorkspaceLink-DK1DWMHe.d.ts → WorkspaceLink-O-EBKUJ8.d.ts} +6 -9
  23. package/dist/{class-names-Bk-QLWWI.js → class-names-BiMDVpUo.js} +4 -1
  24. package/dist/components/Accordion.js +7 -2
  25. package/dist/components/Activity.js +2 -2
  26. package/dist/components/AgentActivity.d.ts +1 -1
  27. package/dist/components/AgentActivity.js +4 -5
  28. package/dist/components/AgentActivityPreview.d.ts +9 -9
  29. package/dist/components/AgentActivityPreview.js +8 -12
  30. package/dist/components/AgentAttention.d.ts +1 -1
  31. package/dist/components/AgentAttention.js +1 -1
  32. package/dist/components/AgentChat.d.ts +1 -1
  33. package/dist/components/AgentChat.js +94 -62
  34. package/dist/components/AgentChatMessageEditor.js +2 -2
  35. package/dist/components/AgentChatTurnError.js +2 -2
  36. package/dist/components/AgentConnection.js +3 -3
  37. package/dist/components/AgentMessageParts.js +1 -1
  38. package/dist/components/AgentToolDetail.d.ts +6 -4
  39. package/dist/components/AgentToolDetail.js +12 -10
  40. package/dist/components/AlertDialog.js +1 -1
  41. package/dist/components/AppTopBar.d.ts +24 -7
  42. package/dist/components/AppTopBar.js +32 -8
  43. package/dist/components/Approval.js +4 -4
  44. package/dist/components/Artifact.d.ts +1 -1
  45. package/dist/components/Artifact.js +6 -4
  46. package/dist/components/Autocomplete.js +1 -1
  47. package/dist/components/Avatar.d.ts +1 -1
  48. package/dist/components/Avatar.js +2 -2
  49. package/dist/components/Badge.js +3 -0
  50. package/dist/components/BrowserLiveView.js +27 -12
  51. package/dist/components/BrowserReplay.js +4 -3
  52. package/dist/components/BrowserRunPanel.js +5 -5
  53. package/dist/components/Button.d.ts +1 -1
  54. package/dist/components/Button.js +14 -11
  55. package/dist/components/Card.d.ts +7 -8
  56. package/dist/components/Card.js +19 -10
  57. package/dist/components/ChainOfThought.d.ts +1 -1
  58. package/dist/components/ChainOfThought.js +2 -2
  59. package/dist/components/ChatGptSignInScreen.js +8 -8
  60. package/dist/components/Checkbox.js +2 -2
  61. package/dist/components/CheckboxGroup.js +1 -1
  62. package/dist/components/Checkpoint.js +2 -2
  63. package/dist/components/CodeBlock.d.ts +1 -1
  64. package/dist/components/CodeBlock.js +1 -1
  65. package/dist/components/CodexModelSelector.js +2 -2
  66. package/dist/components/Collapsible.js +2 -2
  67. package/dist/components/Combobox.js +1 -1
  68. package/dist/components/Commit.d.ts +1 -1
  69. package/dist/components/Commit.js +3 -3
  70. package/dist/components/Context.js +1 -1
  71. package/dist/components/ContextMenu.js +2 -2
  72. package/dist/components/Conversation.d.ts +1 -1
  73. package/dist/components/Conversation.js +5 -4
  74. package/dist/components/DescriptionListParts.js +1 -1
  75. package/dist/components/Dialog.js +1 -1
  76. package/dist/components/EnvironmentVariables.d.ts +1 -1
  77. package/dist/components/EnvironmentVariables.js +3 -3
  78. package/dist/components/Field.js +5 -2
  79. package/dist/components/Fieldset.js +1 -1
  80. package/dist/components/FileTree.d.ts +6 -0
  81. package/dist/components/FileTree.js +1 -1
  82. package/dist/components/Form.js +1 -1
  83. package/dist/components/GithubMotionMark.js +1 -1
  84. package/dist/components/IconButton.d.ts +2 -3
  85. package/dist/components/IconButton.js +2 -1
  86. package/dist/components/InlineCitation.js +1 -1
  87. package/dist/components/Input.js +1 -1
  88. package/dist/components/Marker.js +1 -1
  89. package/dist/components/McpConnectionRequest.js +2 -2
  90. package/dist/components/McpServerPicker.js +2 -2
  91. package/dist/components/MediaPreviewCard.d.ts +103 -0
  92. package/dist/components/MediaPreviewCard.js +193 -0
  93. package/dist/components/Menu.js +1 -1
  94. package/dist/components/Menubar.js +2 -2
  95. package/dist/components/Message.d.ts +4 -1
  96. package/dist/components/Message.js +1 -1
  97. package/dist/components/MessageScroller.d.ts +1 -1
  98. package/dist/components/MessageScroller.js +5 -4
  99. package/dist/components/Meter.js +1 -1
  100. package/dist/components/ModelSelector.d.ts +4 -3
  101. package/dist/components/ModelSelector.js +1 -1
  102. package/dist/components/NavigationMenu.js +1 -1
  103. package/dist/components/NumberField.js +1 -1
  104. package/dist/components/Plan.js +2 -2
  105. package/dist/components/Popover.js +1 -1
  106. package/dist/components/PreviewCard.js +1 -1
  107. package/dist/components/PricingBillingToggle.js +1 -1
  108. package/dist/components/PricingFAQ.js +1 -1
  109. package/dist/components/PricingPage.js +2 -1
  110. package/dist/components/PricingPlanCard.js +4 -3
  111. package/dist/components/PricingUsageCalculator.js +2 -2
  112. package/dist/components/Progress.js +1 -1
  113. package/dist/components/PromptInput.d.ts +1 -1
  114. package/dist/components/PromptInput.js +33 -20
  115. package/dist/components/Queue.d.ts +1 -1
  116. package/dist/components/Queue.js +2 -3
  117. package/dist/components/RadioGroup.js +1 -1
  118. package/dist/components/Reasoning.js +3 -6
  119. package/dist/components/ResizableSidePanel.js +1 -1
  120. package/dist/components/ResponsiveSidebarShell.js +16 -10
  121. package/dist/components/ScrollArea.js +2 -1
  122. package/dist/components/SearchField.d.ts +43 -0
  123. package/dist/components/SearchField.js +52 -0
  124. package/dist/components/Select.d.ts +1 -1
  125. package/dist/components/Select.js +5 -6
  126. package/dist/components/Separator.js +1 -1
  127. package/dist/components/Slider.js +1 -1
  128. package/dist/components/Sources.js +2 -2
  129. package/dist/components/Stepper.js +16 -9
  130. package/dist/components/SubagentRunDetails.js +1 -1
  131. package/dist/components/SubagentRunIndicator.js +2 -2
  132. package/dist/components/SubagentRunList.d.ts +3 -5
  133. package/dist/components/SubagentRunList.js +3 -4
  134. package/dist/components/SubagentRunSelector.d.ts +8 -12
  135. package/dist/components/SubagentRunSelector.js +17 -20
  136. package/dist/components/Switch.d.ts +2 -2
  137. package/dist/components/Switch.js +4 -5
  138. package/dist/components/Tabs.d.ts +2 -2
  139. package/dist/components/Tabs.js +12 -3
  140. package/dist/components/Task.js +2 -2
  141. package/dist/components/Terminal.d.ts +2 -2
  142. package/dist/components/Terminal.js +5 -4
  143. package/dist/components/TestResults.js +10 -6
  144. package/dist/components/Textarea.js +1 -1
  145. package/dist/components/ThemeModeControl.js +1 -1
  146. package/dist/components/ThinkChat.d.ts +33 -20
  147. package/dist/components/ThinkChat.js +4 -4
  148. package/dist/components/ThinkChatActivity.d.ts +2 -2
  149. package/dist/components/ThinkChatActivity.js +8 -10
  150. package/dist/components/ThinkChatActivitySummary.d.ts +1 -1
  151. package/dist/components/ThinkChatActivitySummary.js +7 -3
  152. package/dist/components/ThinkChatToolPanels.js +26 -16
  153. package/dist/components/ThinkExecutionDetail.js +2 -2
  154. package/dist/components/ThinkExecutionStatus.js +2 -2
  155. package/dist/components/ThinkExecutionWorkbench.d.ts +30 -8
  156. package/dist/components/ThinkExecutionWorkbench.js +70 -134
  157. package/dist/components/ThinkFullApp.d.ts +36 -35
  158. package/dist/components/ThinkFullApp.js +156 -109
  159. package/dist/components/ThinkFullAppViewSwitch.d.ts +1 -1
  160. package/dist/components/ThinkFullAppViewSwitch.js +1 -1
  161. package/dist/components/ThinkRecoveryNotice.js +18 -12
  162. package/dist/components/ThinkRoutineBrowser.d.ts +17 -9
  163. package/dist/components/ThinkRoutineBrowser.js +33 -40
  164. package/dist/components/ThinkRoutineDetail.d.ts +5 -2
  165. package/dist/components/ThinkRoutineDetail.js +4 -4
  166. package/dist/components/ThinkRoutineForm.d.ts +3 -2
  167. package/dist/components/ThinkRoutineForm.js +11 -10
  168. package/dist/components/ThinkRoutineLibrary.d.ts +24 -31
  169. package/dist/components/ThinkRoutineLibrary.js +57 -80
  170. package/dist/components/ThinkRoutineRuns.d.ts +3 -2
  171. package/dist/components/ThinkRoutineRuns.js +31 -24
  172. package/dist/components/ThinkThreadPicker.d.ts +17 -11
  173. package/dist/components/ThinkThreadPicker.js +163 -39
  174. package/dist/components/Toast.js +1 -1
  175. package/dist/components/Toggle.d.ts +1 -1
  176. package/dist/components/Toggle.js +9 -7
  177. package/dist/components/ToggleGroup.d.ts +1 -1
  178. package/dist/components/ToggleGroup.js +15 -13
  179. package/dist/components/ToolInvocation.js +1 -1
  180. package/dist/components/Toolbar.js +1 -1
  181. package/dist/components/Tooltip.d.ts +8 -1
  182. package/dist/components/Tooltip.js +11 -2
  183. package/dist/components/TransitionSurface.d.ts +27 -0
  184. package/dist/components/TransitionSurface.js +20 -0
  185. package/dist/components/WebPreview.d.ts +5 -5
  186. package/dist/components/WebPreview.js +68 -54
  187. package/dist/components/Workspace.d.ts +2 -2
  188. package/dist/components/Workspace.js +358 -328
  189. package/dist/components/WorkspaceBrowser.d.ts +4 -7
  190. package/dist/components/WorkspaceBrowser.js +15 -25
  191. package/dist/components/WorkspaceExplorer.d.ts +5 -5
  192. package/dist/components/WorkspaceExplorer.js +19 -32
  193. package/dist/components/WorkspaceFile.d.ts +1 -1
  194. package/dist/components/WorkspaceFileView.d.ts +14 -2
  195. package/dist/components/WorkspaceFileView.js +1 -1
  196. package/dist/components/WorkspaceHeader.d.ts +0 -8
  197. package/dist/components/WorkspaceHeader.js +3 -15
  198. package/dist/components/WorkspaceLink.d.ts +1 -1
  199. package/dist/components/WorkspaceLink.js +1 -1
  200. package/dist/components/icons.d.ts +2 -2
  201. package/dist/components/icons.js +2 -2
  202. package/dist/{copy-button-CQx3LQAC.d.ts → copy-button-D7aAYA-2.d.ts} +1 -1
  203. package/dist/{copy-button-cYsJBauI.js → copy-button-DeK6KXEV.js} +3 -2
  204. package/dist/{icons--FqCZEc3.js → icons-CQJ-aMnI.js} +6 -3
  205. package/dist/{icons-DpUqY8Mp.d.ts → icons-CYXmvKlJ.d.ts} +17 -2
  206. package/dist/navigation-link-Cob7KBlM.js +19 -0
  207. package/dist/styles/accordion.css +4 -19
  208. package/dist/styles/activity.css +48 -56
  209. package/dist/styles/agent-activity-preview.css +2 -0
  210. package/dist/styles/agent-chat.css +14 -22
  211. package/dist/styles/alert-dialog.css +16 -18
  212. package/dist/styles/app-top-bar.css +17 -9
  213. package/dist/styles/approval.css +11 -6
  214. package/dist/styles/artifact.css +6 -6
  215. package/dist/styles/autocomplete.css +2 -1
  216. package/dist/styles/avatar.css +35 -30
  217. package/dist/styles/badge.css +10 -10
  218. package/dist/styles/base-ui-motion.css +94 -39
  219. package/dist/styles/browser-control-overlay.css +0 -1
  220. package/dist/styles/browser-live-view.css +39 -22
  221. package/dist/styles/browser-replay.css +1 -1
  222. package/dist/styles/browser-run-panel.css +8 -4
  223. package/dist/styles/button.css +36 -33
  224. package/dist/styles/card.css +5 -6
  225. package/dist/styles/chain-of-thought.css +22 -16
  226. package/dist/styles/checkbox.css +18 -5
  227. package/dist/styles/codex-model-selector.css +3 -7
  228. package/dist/styles/collapsible.css +10 -10
  229. package/dist/styles/combobox.css +3 -2
  230. package/dist/styles/commit.css +19 -18
  231. package/dist/styles/composition-motion.css +83 -0
  232. package/dist/styles/context-menu.css +3 -3
  233. package/dist/styles/context.css +11 -10
  234. package/dist/styles/conversation.css +18 -23
  235. package/dist/styles/dialog.css +15 -15
  236. package/dist/styles/field.css +32 -12
  237. package/dist/styles/file-tree.css +69 -9
  238. package/dist/styles/form.css +1 -1
  239. package/dist/styles/index.css +5 -0
  240. package/dist/styles/input.css +2 -2
  241. package/dist/styles/marker.css +14 -13
  242. package/dist/styles/mcp-server-picker.css +20 -17
  243. package/dist/styles/media-preview-card.css +160 -0
  244. package/dist/styles/menu.css +11 -11
  245. package/dist/styles/menubar.css +12 -11
  246. package/dist/styles/message.css +27 -21
  247. package/dist/styles/meter.css +2 -2
  248. package/dist/styles/model-selector.css +16 -14
  249. package/dist/styles/motion-reduction.css +29 -0
  250. package/dist/styles/navigation-menu.css +14 -30
  251. package/dist/styles/number-field.css +22 -4
  252. package/dist/styles/plan.css +5 -0
  253. package/dist/styles/popover.css +15 -16
  254. package/dist/styles/preview-card.css +2 -32
  255. package/dist/styles/progress.css +8 -3
  256. package/dist/styles/prompt-input.css +75 -75
  257. package/dist/styles/queue.css +48 -32
  258. package/dist/styles/radio.css +19 -12
  259. package/dist/styles/reasoning.css +2 -1
  260. package/dist/styles/recipes.css +109 -37
  261. package/dist/styles/resizable-side-panel.css +4 -10
  262. package/dist/styles/responsive-sidebar-shell.css +16 -15
  263. package/dist/styles/scroll-area.css +32 -15
  264. package/dist/styles/search-field.css +21 -0
  265. package/dist/styles/select.css +19 -12
  266. package/dist/styles/slider.css +25 -29
  267. package/dist/styles/sources.css +3 -3
  268. package/dist/styles/stepper.css +36 -26
  269. package/dist/styles/subagent-run.css +1 -1
  270. package/dist/styles/switch.css +32 -29
  271. package/dist/styles/tabs.css +79 -23
  272. package/dist/styles/task.css +13 -9
  273. package/dist/styles/test-results.css +29 -23
  274. package/dist/styles/theme-mode-control.css +8 -0
  275. package/dist/styles/think-execution-workbench.css +18 -15
  276. package/dist/styles/think-full-app.css +45 -68
  277. package/dist/styles/think-routine-library.css +43 -24
  278. package/dist/styles/think-thread-picker.css +193 -51
  279. package/dist/styles/toast.css +48 -27
  280. package/dist/styles/toggle-group.css +2 -36
  281. package/dist/styles/toggle.css +29 -5
  282. package/dist/styles/toolbar.css +25 -27
  283. package/dist/styles/tooltip.css +2 -32
  284. package/dist/styles/transition-surface.css +55 -0
  285. package/dist/styles/workspace-explorer.css +99 -44
  286. package/dist/summarize-tool-input-CqTcGRYy.js +15 -0
  287. package/dist/utils/mcp-server-catalog.d.ts +132 -0
  288. package/dist/utils/mcp-server-catalog.js +90 -0
  289. package/dist/utils/structured-code.d.ts +1 -1
  290. package/package.json +13 -7
  291. package/dist/Workspace-C9RFoxcu.d.ts +0 -62
  292. package/dist/summarize-tool-input-BUJsENSn.js +0 -12
@@ -105,28 +105,27 @@ function ThinkChatActivityStep({ text, part, toolRenderers }) {
105
105
  children: text
106
106
  });
107
107
  }
108
- function ThinkChatActivityGroup({ message, onAgentToolRunSelect, parts, selectedAgentToolRunId, isTrailing, toolRenderers }) {
108
+ function ThinkChatActivityGroup({ message, parts, renderAgentToolRunLink, isTrailing, toolRenderers }) {
109
109
  const chat = useOptionalThinkChatContext();
110
110
  const chatStillWorking = isTrailing && Boolean(chat?.isStreaming) && chat?.messages.at(-1)?.id === message.id;
111
111
  const agentTools = useOptionalAgentToolRuns();
112
112
  const runs = React.useMemo(() => {
113
- if (!agentTools || !onAgentToolRunSelect) return [];
113
+ if (!agentTools || !renderAgentToolRunLink) return [];
114
114
  return parts.flatMap((part) => isToolUIPart(part) ? agentTools.getRunsForToolCall(part.toolCallId) : []);
115
115
  }, [
116
116
  agentTools,
117
- onAgentToolRunSelect,
118
- parts
117
+ parts,
118
+ renderAgentToolRunLink
119
119
  ]);
120
120
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ThinkChatActivity, {
121
121
  parts,
122
122
  isStreaming: parts.some(isPartWorking) || chatStillWorking,
123
123
  toolRenderers
124
- }), runs.length ? /* @__PURE__ */ jsx(SubagentRunList, {
124
+ }), runs.length && renderAgentToolRunLink ? /* @__PURE__ */ jsx(SubagentRunList, {
125
125
  className: "subagent-run__list--adjacent",
126
126
  "aria-label": "Delegated agent runs",
127
127
  runs,
128
- selectedRunId: selectedAgentToolRunId,
129
- onSelect: onAgentToolRunSelect
128
+ renderRunLink: renderAgentToolRunLink
130
129
  }) : null] });
131
130
  }
132
131
  /**
@@ -136,7 +135,7 @@ function ThinkChatActivityGroup({ message, onAgentToolRunSelect, parts, selected
136
135
  * state. Excluded tools split the run and return undefined so your own
137
136
  * renderPart (or AgentChat's generic activity row) takes over for them.
138
137
  */
139
- function createThinkChatActivityRenderer({ excludeTools, onAgentToolRunSelect, selectedAgentToolRunId, toolRenderers } = {}) {
138
+ function createThinkChatActivityRenderer({ excludeTools, renderAgentToolRunLink, toolRenderers } = {}) {
140
139
  const excluded = excludeTools?.length ? new Set(excludeTools) : void 0;
141
140
  const isActivity = (part) => isThinkChatActivityPart(part, excluded);
142
141
  return (context) => {
@@ -152,8 +151,7 @@ function createThinkChatActivityRenderer({ excludeTools, onAgentToolRunSelect, s
152
151
  parts: message.parts.slice(start, end + 1),
153
152
  isTrailing: end === message.parts.length - 1,
154
153
  toolRenderers,
155
- selectedAgentToolRunId,
156
- onAgentToolRunSelect
154
+ renderAgentToolRunLink
157
155
  });
158
156
  };
159
157
  }
@@ -1,2 +1,2 @@
1
- import { a as activityPartIconKind, c as deriveThinkChatToolLifecycleHeader, i as ThinkChatToolLifecycleSnapshot, l as describeThinkChatActivityPart, n as ThinkChatToolDescriber, o as activityPartUrl, r as ThinkChatToolDescribers, s as deriveThinkChatActivityHeader, t as ThinkChatActivityHeader, u as summarizeActivitySteps } from "../ThinkChatActivitySummary-BPmu9a-c.js";
1
+ import { a as activityPartIconKind, c as deriveThinkChatToolLifecycleHeader, i as ThinkChatToolLifecycleSnapshot, l as describeThinkChatActivityPart, n as ThinkChatToolDescriber, o as activityPartUrl, r as ThinkChatToolDescribers, s as deriveThinkChatActivityHeader, t as ThinkChatActivityHeader, u as summarizeActivitySteps } from "../ThinkChatActivitySummary-D1xOrNrq.js";
2
2
  export { ThinkChatActivityHeader, ThinkChatToolDescriber, ThinkChatToolDescribers, ThinkChatToolLifecycleSnapshot, activityPartIconKind, activityPartUrl, deriveThinkChatActivityHeader, deriveThinkChatToolLifecycleHeader, describeThinkChatActivityPart, summarizeActivitySteps };
@@ -1,5 +1,5 @@
1
1
  import { displayUrl, getToolDisplayName, isBrowserToolPart, isExecuteToolPart, isFetchToolPart, isPartFailed, isPartWorking, isSessionContextToolFailure, isSessionContextToolPart, isSkillToolPart, isWorkspaceToolPart } from "./ThinkChatToolParts.js";
2
- import { t as summarizeToolInput } from "../summarize-tool-input-BUJsENSn.js";
2
+ import { t as summarizeToolInput } from "../summarize-tool-input-CqTcGRYy.js";
3
3
  import { getToolName, isReasoningUIPart, isToolUIPart } from "ai";
4
4
  //#region src/components/ThinkChatActivitySummary.ts
5
5
  const ACTIVITY_HEADER_LABEL_MAX_LENGTH = 240;
@@ -310,6 +310,7 @@ function summarizeActivitySteps(parts) {
310
310
  if (browses > 0) segments.push("used the browser");
311
311
  if (codeRuns > 0) segments.push("ran code");
312
312
  if (commands > 0) segments.push(commands === 1 ? "ran a command" : `ran ${commands} commands`);
313
+ const includedSegments = new Set(segments);
313
314
  for (const segment of [
314
315
  "edited files",
315
316
  "searched code",
@@ -318,8 +319,11 @@ function summarizeActivitySteps(parts) {
318
319
  "ran a command",
319
320
  "read files",
320
321
  "used a tool"
321
- ]) if (genericSegments.has(segment)) segments.push(segment);
322
- for (const segment of genericSegments) if (!segments.includes(segment)) segments.push(segment);
322
+ ]) if (genericSegments.has(segment)) {
323
+ segments.push(segment);
324
+ includedSegments.add(segment);
325
+ }
326
+ for (const segment of genericSegments) if (!includedSegments.has(segment)) segments.push(segment);
323
327
  if (segments.length === 0) return "Worked";
324
328
  const top = segments.slice(0, 3);
325
329
  const joined = top.length === 1 ? top[0] : `${top.slice(0, -1).join(", ")} and ${top.at(-1)}`;
@@ -1,8 +1,9 @@
1
1
  import { ActivityOutput, ActivityPanel } from "./Activity.js";
2
2
  import { displayUrl, isSessionContextToolFailure } from "./ThinkChatToolParts.js";
3
3
  import { Tabs } from "./Tabs.js";
4
- import { t as CodeBlock } from "../CodeBlock-Co1noLbC.js";
4
+ import { t as CodeBlock } from "../CodeBlock-Bfp5PAg3.js";
5
5
  import { BrowserLiveView } from "./BrowserLiveView.js";
6
+ import { inferWorkspaceLanguage } from "./WorkspaceFile.js";
6
7
  import * as React from "react";
7
8
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
9
  import { getToolName } from "ai";
@@ -15,11 +16,6 @@ function renderDeniedPanel(label, reason) {
15
16
  error: true
16
17
  });
17
18
  }
18
- function numberLines(content, from = 1) {
19
- const lines = content.split("\n");
20
- const width = String(from + lines.length - 1).length;
21
- return lines.map((line, i) => `${String(from + i).padStart(width)} ${line}`).join("\n");
22
- }
23
19
  function prefixLines(text, prefix) {
24
20
  return text.split("\n").map((line) => `${prefix}${line}`).join("\n");
25
21
  }
@@ -58,11 +54,19 @@ function ThinkChatWorkspacePanel({ part }) {
58
54
  return /* @__PURE__ */ jsx(ActivityPanel, { label });
59
55
  }
60
56
  case "tool-write": {
57
+ const path = part.input?.path ?? "file";
58
+ const content = part.input?.content;
61
59
  const output = part.state === "output-available" ? part.output : void 0;
62
60
  return /* @__PURE__ */ jsx(ActivityPanel, {
63
- label: part.input?.path ?? "file",
64
- text: part.input?.content ? numberLines(part.input.content) : void 0,
65
- status: output ? `${output.lines} lines written` : void 0
61
+ label: path,
62
+ status: output ? `${output.lines} lines written` : void 0,
63
+ children: content !== void 0 ? /* @__PURE__ */ jsx(CodeBlock, {
64
+ className: "activity__code-block",
65
+ code: content,
66
+ isStreaming: part.state === "input-streaming",
67
+ language: inferWorkspaceLanguage(path),
68
+ showLineNumbers: true
69
+ }) : null
66
70
  });
67
71
  }
68
72
  case "tool-edit": {
@@ -402,19 +406,25 @@ function ThinkChatBrowserPanel({ part }) {
402
406
  children: [
403
407
  /* @__PURE__ */ jsxs(Tabs.List, {
404
408
  variant: "line",
405
- children: [/* @__PURE__ */ jsx(Tabs.Tab, {
406
- value: "browser",
407
- children: "Preview"
408
- }), /* @__PURE__ */ jsx(Tabs.Tab, {
409
- value: "code",
410
- children: "Code"
411
- })]
409
+ children: [
410
+ /* @__PURE__ */ jsx(Tabs.Tab, {
411
+ value: "browser",
412
+ children: "Preview"
413
+ }),
414
+ /* @__PURE__ */ jsx(Tabs.Tab, {
415
+ value: "code",
416
+ children: "Code"
417
+ }),
418
+ /* @__PURE__ */ jsx(Tabs.Indicator, {})
419
+ ]
412
420
  }),
413
421
  /* @__PURE__ */ jsx(Tabs.Panel, {
422
+ className: "activity__browser-panel",
414
423
  value: "browser",
415
424
  children: browserView
416
425
  }),
417
426
  /* @__PURE__ */ jsx(Tabs.Panel, {
427
+ className: "activity__browser-panel",
418
428
  value: "code",
419
429
  children: codeView
420
430
  })
@@ -1,5 +1,5 @@
1
- import { t as cx } from "../class-names-Bk-QLWWI.js";
2
- import { C as InfoIcon, K as TerminalIcon, R as RefreshIcon, X as XIcon, s as CheckIcon, t as ArrowDownIcon, y as FileIcon } from "../icons--FqCZEc3.js";
1
+ import { t as cx } from "../class-names-BiMDVpUo.js";
2
+ import { $ as XIcon, E as InfoIcon, H as RefreshIcon, Y as TerminalIcon, l as CheckIcon, n as ArrowDownIcon, x as FileIcon } from "../icons-CQJ-aMnI.js";
3
3
  import { Activity, ActivityContent, ActivityItem, ActivityItemGroup, ActivityOutput, ActivityPanel, ActivityTrigger } from "./Activity.js";
4
4
  import { formatThinkExecutionRunProgress, formatThinkExecutionStatus, formatThinkExecutionTimestamp, getThinkExecutionRunError, getThinkExecutionRunId, getThinkExecutionRunProgressedAt, getThinkExecutionRunProgressedLabel, getThinkExecutionRunStatus, getThinkExecutionRunTitle, isThinkSubmissionRun } from "./ThinkExecutionRun.js";
5
5
  import { ThinkExecutionStatus } from "./ThinkExecutionStatus.js";
@@ -1,5 +1,5 @@
1
- import { t as cx } from "../class-names-Bk-QLWWI.js";
2
- import { C as InfoIcon, N as PauseIcon, V as SpinnerIcon, X as XIcon, s as CheckIcon } from "../icons--FqCZEc3.js";
1
+ import { t as cx } from "../class-names-BiMDVpUo.js";
2
+ import { $ as XIcon, E as InfoIcon, G as SpinnerIcon, L as PauseIcon, l as CheckIcon } from "../icons-CQJ-aMnI.js";
3
3
  import { Tooltip } from "./Tooltip.js";
4
4
  import { formatThinkExecutionStatus, getThinkExecutionRunStatus, getThinkExecutionRunStatusTone } from "./ThinkExecutionRun.js";
5
5
  import "react";
@@ -1,20 +1,41 @@
1
1
  import { t as ThinkExecutionRun } from "../ThinkExecutionRun-ChhWhOoU.js";
2
2
  import * as React from "react";
3
- import { Think } from "@cloudflare/think";
3
+ import { DataTag, UndefinedInitialDataOptions } from "@tanstack/react-query";
4
+ import { Think, ThinkSubmissionInspection } from "@cloudflare/think";
4
5
  import { AgentStub } from "agents/client";
6
+ import { WorkflowPage } from "agents/workflows";
5
7
 
6
8
  //#region src/components/ThinkExecutionWorkbench.d.ts
7
9
  interface ThinkExecutionWorkbenchProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
8
10
  /** Agents SDK client stub for a Think agent; this UI calls native submission/workflow methods. */
9
11
  source: AgentStub<Think>;
12
+ /**
13
+ * Stable, serializable identity for the remote Think agent. It must change
14
+ * when `source` points at a different agent and must not contain credentials.
15
+ */
16
+ sourceKey: string;
10
17
  title?: React.ReactNode;
11
18
  backButton?: React.ReactNode;
12
19
  pageSize?: number;
13
- /** Whole native execution selected by a parent-owned route or product record. */
14
- selectedRun?: ThinkExecutionRun | null;
15
- /** Receives the fully inspected native execution after a user selects a row. */
16
- onSelectedRunChange?: (run: ThinkExecutionRun) => void;
20
+ /** Whole native execution selected by the application route. */
21
+ selectedRun: ThinkExecutionRun | null;
22
+ /** Returns an application-authored TanStack Router Link for the run. */
23
+ renderRunLink: (run: ThinkExecutionRun) => React.ReactElement;
17
24
  }
25
+ interface ThinkExecutionRunsData {
26
+ submissions: readonly ThinkSubmissionInspection[];
27
+ workflows: WorkflowPage;
28
+ }
29
+ type ThinkExecutionRunsQueryKey = readonly ["think", sourceKey: string, "execution-runs", {
30
+ readonly limit: number;
31
+ }];
32
+ type ThinkExecutionRunsQueryOptions = UndefinedInitialDataOptions<ThinkExecutionRunsData, Error, ThinkExecutionRunsData, ThinkExecutionRunsQueryKey> & {
33
+ queryKey: DataTag<ThinkExecutionRunsQueryKey, ThinkExecutionRunsData, Error>;
34
+ };
35
+ /**
36
+ * Shared list options for component reads and TanStack Router loaders.
37
+ */
38
+ declare function thinkExecutionRunsQueryOptions(source: AgentStub<Think>, sourceKey: string, pageSize?: number): ThinkExecutionRunsQueryOptions;
18
39
  /**
19
40
  * Unified execution history for native Think submissions and Agents workflows.
20
41
  * The workbench reads and acts through the whole upstream agent stub; it does
@@ -23,15 +44,16 @@ interface ThinkExecutionWorkbenchProps extends Omit<React.HTMLAttributes<HTMLDiv
23
44
  declare function ThinkExecutionWorkbench({
24
45
  backButton,
25
46
  className,
26
- onSelectedRunChange,
27
47
  pageSize,
28
48
  ref,
29
- selectedRun: controlledSelectedRun,
49
+ renderRunLink,
50
+ selectedRun,
30
51
  source,
52
+ sourceKey,
31
53
  title,
32
54
  ...props
33
55
  }: ThinkExecutionWorkbenchProps & {
34
56
  ref?: React.Ref<HTMLDivElement>;
35
57
  }): React.JSX.Element;
36
58
  //#endregion
37
- export { ThinkExecutionWorkbench, ThinkExecutionWorkbenchProps };
59
+ export { ThinkExecutionRunsData, ThinkExecutionRunsQueryKey, ThinkExecutionRunsQueryOptions, ThinkExecutionWorkbench, ThinkExecutionWorkbenchProps, thinkExecutionRunsQueryOptions };
@@ -1,6 +1,7 @@
1
- import { t as cx } from "../class-names-Bk-QLWWI.js";
2
- import { R as RefreshIcon, g as EllipsisIcon } from "../icons--FqCZEc3.js";
3
- import { Button } from "./Button.js";
1
+ import { t as cx } from "../class-names-BiMDVpUo.js";
2
+ import { H as RefreshIcon, v as EllipsisIcon } from "../icons-CQJ-aMnI.js";
3
+ import { t as NavigationLink } from "../navigation-link-Cob7KBlM.js";
4
+ import { Button, buttonVariants } from "./Button.js";
4
5
  import { Tooltip } from "./Tooltip.js";
5
6
  import { Menu } from "./Menu.js";
6
7
  import { AppTopBar } from "./AppTopBar.js";
@@ -9,6 +10,7 @@ import { ThinkExecutionStatus } from "./ThinkExecutionStatus.js";
9
10
  import { ThinkExecutionDetail } from "./ThinkExecutionDetail.js";
10
11
  import * as React from "react";
11
12
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
+ import { queryOptions, useMutation, useQuery } from "@tanstack/react-query";
12
14
  //#region src/components/ThinkExecutionWorkbench.tsx
13
15
  const executionPanelPageSize = 20;
14
16
  function getErrorMessage(error) {
@@ -17,6 +19,13 @@ function getErrorMessage(error) {
17
19
  function isSubmissionCancelable(status) {
18
20
  return status === "pending" || status === "running";
19
21
  }
22
+ function thinkExecutionRunsScopeQueryKey(sourceKey) {
23
+ return [
24
+ "think",
25
+ sourceKey,
26
+ "execution-runs"
27
+ ];
28
+ }
20
29
  function RunActions({ busy, onAction, run, source }) {
21
30
  const id = getThinkExecutionRunId(run);
22
31
  const statusTone = getThinkExecutionRunStatusTone(run);
@@ -28,7 +37,8 @@ function RunActions({ busy, onAction, run, source }) {
28
37
  type: "button",
29
38
  variant: "ghost",
30
39
  color: "neutral",
31
- size: "icon-xs",
40
+ size: "sm",
41
+ iconOnly: true,
32
42
  className: "think-execution-workbench__run-actions",
33
43
  "aria-label": `Actions for ${kind} ${id}`,
34
44
  disabled: busy,
@@ -91,129 +101,51 @@ function RunActions({ busy, onAction, run, source }) {
91
101
  }) })] });
92
102
  }
93
103
  /**
104
+ * Shared list options for component reads and TanStack Router loaders.
105
+ */
106
+ function thinkExecutionRunsQueryOptions(source, sourceKey, pageSize = executionPanelPageSize) {
107
+ return queryOptions({
108
+ queryKey: [...thinkExecutionRunsScopeQueryKey(sourceKey), { limit: pageSize }],
109
+ queryFn: async () => {
110
+ const [submissions, workflows] = await Promise.all([source.listSubmissions({ limit: pageSize }), source.getWorkflows({
111
+ limit: pageSize,
112
+ orderBy: "desc"
113
+ })]);
114
+ return {
115
+ submissions,
116
+ workflows
117
+ };
118
+ },
119
+ staleTime: 5e3
120
+ });
121
+ }
122
+ /**
94
123
  * Unified execution history for native Think submissions and Agents workflows.
95
124
  * The workbench reads and acts through the whole upstream agent stub; it does
96
125
  * not normalize execution records or own workflow authoring.
97
126
  */
98
- function ThinkExecutionWorkbench({ backButton, className, onSelectedRunChange, pageSize = executionPanelPageSize, ref, selectedRun: controlledSelectedRun, source, title = "Execution", ...props }) {
127
+ function ThinkExecutionWorkbench({ backButton, className, pageSize = executionPanelPageSize, ref, renderRunLink, selectedRun, source, sourceKey, title = "Execution", ...props }) {
99
128
  const runsId = React.useId();
100
- const activeSourceRef = React.useRef(source);
101
- const sourceGenerationRef = React.useRef(0);
102
- const operationSequenceRef = React.useRef(0);
103
- const [busyAction, setBusyAction] = React.useState("refresh");
104
- const [error, setError] = React.useState(null);
105
- const [executionData, setExecutionData] = React.useState(null);
106
- const [selection, setSelection] = React.useState(null);
107
- const activeExecutionData = executionData?.source === source ? executionData : null;
108
- const innerSelectedRun = selection?.source === source ? selection.run : null;
109
- const selectedRun = controlledSelectedRun === void 0 ? innerSelectedRun : controlledSelectedRun;
110
- const runs = React.useMemo(() => [...activeExecutionData?.submissions ?? [], ...activeExecutionData?.workflows.workflows ?? []].sort((first, second) => Number(second.createdAt) - Number(first.createdAt)), [activeExecutionData]);
111
- const isCurrentOperation = React.useCallback((operation) => activeSourceRef.current === operation.source && sourceGenerationRef.current === operation.generation && operationSequenceRef.current === operation.sequence, []);
112
- const beginOperation = React.useCallback(() => {
113
- if (activeSourceRef.current !== source) return null;
114
- return {
115
- generation: sourceGenerationRef.current,
116
- sequence: ++operationSequenceRef.current,
129
+ const runsOptions = thinkExecutionRunsQueryOptions(source, sourceKey, pageSize);
130
+ const runsQueryKey = thinkExecutionRunsScopeQueryKey(sourceKey);
131
+ const runsQuery = useQuery(runsOptions);
132
+ const actionMutation = useMutation({
133
+ mutationFn: ({ action }) => action(),
134
+ onSuccess: (_result, action, _onMutateResult, context) => context.client.invalidateQueries({ queryKey: action.runsQueryKey })
135
+ });
136
+ const currentAction = actionMutation.variables?.source === source ? actionMutation.variables : null;
137
+ const actionIsPending = currentAction !== null && actionMutation.isPending;
138
+ const busyAction = actionIsPending ? currentAction.key : runsQuery.isFetching ? "refresh" : null;
139
+ const error = currentAction && actionMutation.isError ? actionMutation.error : runsQuery.error;
140
+ const runs = React.useMemo(() => [...runsQuery.data?.submissions ?? [], ...runsQuery.data?.workflows.workflows ?? []].sort((first, second) => Number(second.createdAt) - Number(first.createdAt)), [runsQuery.data]);
141
+ const runAction = (key, action) => {
142
+ actionMutation.mutate({
143
+ action,
144
+ key,
145
+ runsQueryKey,
117
146
  source
118
- };
119
- }, [source]);
120
- const loadData = React.useCallback(async (operation) => {
121
- const [nextSubmissions, nextWorkflows] = await Promise.all([operation.source.listSubmissions({ limit: pageSize }), operation.source.getWorkflows({
122
- limit: pageSize,
123
- orderBy: "desc"
124
- })]);
125
- if (!isCurrentOperation(operation)) return;
126
- setExecutionData({
127
- source: operation.source,
128
- submissions: nextSubmissions,
129
- workflows: nextWorkflows
130
- });
131
- }, [isCurrentOperation, pageSize]);
132
- const refresh = React.useCallback(async () => {
133
- const operation = beginOperation();
134
- if (!operation) return;
135
- setBusyAction("refresh");
136
- setError(null);
137
- try {
138
- await loadData(operation);
139
- } catch (nextError) {
140
- if (!isCurrentOperation(operation)) return;
141
- setError(getErrorMessage(nextError));
142
- } finally {
143
- if (isCurrentOperation(operation)) setBusyAction(null);
144
- }
145
- }, [
146
- beginOperation,
147
- isCurrentOperation,
148
- loadData
149
- ]);
150
- const runAction = React.useCallback(async (key, action) => {
151
- const operation = beginOperation();
152
- if (!operation) return;
153
- setBusyAction(key);
154
- setError(null);
155
- try {
156
- await action(operation);
157
- if (!isCurrentOperation(operation)) return;
158
- await loadData(operation);
159
- } catch (nextError) {
160
- if (!isCurrentOperation(operation)) return;
161
- setError(getErrorMessage(nextError));
162
- } finally {
163
- if (isCurrentOperation(operation)) setBusyAction(null);
164
- }
165
- }, [
166
- beginOperation,
167
- isCurrentOperation,
168
- loadData
169
- ]);
170
- const selectRun = React.useCallback((run) => {
171
- const kind = isThinkSubmissionRun(run) ? "submission" : "workflow";
172
- runAction(`select-${kind}:${getThinkExecutionRunId(run)}`, async (operation) => {
173
- if (isThinkSubmissionRun(run)) {
174
- const inspection = await operation.source.inspectSubmission(run.submissionId);
175
- if (!isCurrentOperation(operation)) return;
176
- const selected = inspection ?? run;
177
- if (controlledSelectedRun === void 0) setSelection({
178
- source: operation.source,
179
- run: selected
180
- });
181
- onSelectedRunChange?.(selected);
182
- return;
183
- }
184
- const workflow = await operation.source.getWorkflow(run.workflowId);
185
- if (!isCurrentOperation(operation)) return;
186
- const selected = workflow ?? run;
187
- if (controlledSelectedRun === void 0) setSelection({
188
- source: operation.source,
189
- run: selected
190
- });
191
- onSelectedRunChange?.(selected);
192
147
  });
193
- }, [
194
- controlledSelectedRun,
195
- isCurrentOperation,
196
- onSelectedRunChange,
197
- runAction
198
- ]);
199
- React.useLayoutEffect(() => {
200
- activeSourceRef.current = source;
201
- sourceGenerationRef.current += 1;
202
- operationSequenceRef.current += 1;
203
- setExecutionData(null);
204
- setSelection(null);
205
- setBusyAction("refresh");
206
- setError(null);
207
- return () => {
208
- if (activeSourceRef.current === source) {
209
- sourceGenerationRef.current += 1;
210
- operationSequenceRef.current += 1;
211
- }
212
- };
213
- }, [source]);
214
- React.useEffect(() => {
215
- refresh();
216
- }, [refresh]);
148
+ };
217
149
  return /* @__PURE__ */ jsxs("div", {
218
150
  ref,
219
151
  className: cx("think-execution-workbench", className),
@@ -231,7 +163,10 @@ function ThinkExecutionWorkbench({ backButton, className, onSelectedRunChange, p
231
163
  /* @__PURE__ */ jsx(AppTopBar.Trailing, { children: /* @__PURE__ */ jsx(AppTopBar.Button, {
232
164
  label: "Refresh runs",
233
165
  disabled: busyAction !== null,
234
- onClick: () => void refresh(),
166
+ onClick: () => {
167
+ actionMutation.reset();
168
+ runsQuery.refetch();
169
+ },
235
170
  children: /* @__PURE__ */ jsx(RefreshIcon, {})
236
171
  }) })
237
172
  ]
@@ -239,7 +174,7 @@ function ThinkExecutionWorkbench({ backButton, className, onSelectedRunChange, p
239
174
  error ? /* @__PURE__ */ jsx("div", {
240
175
  className: "think-execution-workbench__error",
241
176
  role: "alert",
242
- children: error
177
+ children: getErrorMessage(error)
243
178
  }) : null,
244
179
  /* @__PURE__ */ jsxs("div", {
245
180
  className: "think-execution-workbench__content",
@@ -253,7 +188,7 @@ function ThinkExecutionWorkbench({ backButton, className, onSelectedRunChange, p
253
188
  id: runsId,
254
189
  children: "Runs"
255
190
  })
256
- }), busyAction === "refresh" && runs.length === 0 ? /* @__PURE__ */ jsx("p", {
191
+ }), runsQuery.isPending && runs.length === 0 ? /* @__PURE__ */ jsx("p", {
257
192
  className: "think-execution-workbench__empty",
258
193
  role: "status",
259
194
  children: "Loading runs..."
@@ -269,16 +204,17 @@ function ThinkExecutionWorkbench({ backButton, className, onSelectedRunChange, p
269
204
  const selected = isSameThinkExecutionRun(selectedRun, run);
270
205
  return /* @__PURE__ */ jsxs("li", {
271
206
  "data-selected": selected || void 0,
272
- children: [/* @__PURE__ */ jsxs(Button, {
273
- type: "button",
274
- variant: "ghost",
275
- color: "neutral",
276
- size: "sm",
277
- className: "think-execution-workbench__run",
207
+ children: [/* @__PURE__ */ jsxs(NavigationLink, {
208
+ render: renderRunLink(run),
209
+ "data-slot": "button",
210
+ className: buttonVariants({
211
+ variant: "ghost",
212
+ color: "neutral",
213
+ size: "sm",
214
+ className: "think-execution-workbench__run"
215
+ }),
278
216
  "aria-label": getThinkExecutionRunAccessibleName(run),
279
217
  "aria-current": selected ? "page" : void 0,
280
- disabled: busyAction !== null,
281
- onClick: () => selectRun(run),
282
218
  children: [/* @__PURE__ */ jsx(ThinkExecutionStatus, {
283
219
  run,
284
220
  className: "think-execution-workbench__icon"
@@ -296,10 +232,10 @@ function ThinkExecutionWorkbench({ backButton, className, onSelectedRunChange, p
296
232
  })]
297
233
  })]
298
234
  }), /* @__PURE__ */ jsx(RunActions, {
299
- busy: busyAction !== null,
235
+ busy: actionIsPending,
300
236
  run,
301
237
  source,
302
- onAction: (key, action) => void runAction(key, () => action())
238
+ onAction: runAction
303
239
  })]
304
240
  }, `${kind}:${id}`);
305
241
  })
@@ -314,4 +250,4 @@ function ThinkExecutionWorkbench({ backButton, className, onSelectedRunChange, p
314
250
  });
315
251
  }
316
252
  //#endregion
317
- export { ThinkExecutionWorkbench };
253
+ export { ThinkExecutionWorkbench, thinkExecutionRunsQueryOptions };