@mcp-b/react-components 0.14.1 → 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 (241) hide show
  1. package/dist/AgentActivity-BNUNrP9O.d.ts +36 -0
  2. package/dist/{AgentChat-Cgb1xuT7.d.ts → AgentChat-CrlpbvQJ.d.ts} +62 -8
  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-DVgVBdvw.js → ModelSelector-SlJNgwKY.js} +17 -8
  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-7DQ2CogF.js → ThinkChat-CzC-zNGA.js} +27 -37
  12. package/dist/{ThinkChatActivity-m9orbdeI.d.ts → ThinkChatActivity-BFQnb2ct.d.ts} +3 -10
  13. package/dist/ThinkChatActivitySummary-BPmu9a-c.d.ts +39 -0
  14. package/dist/{ThinkChatToolParts-Cv4o7j6F.d.ts → ThinkChatToolParts-CSzVwMXf.d.ts} +62 -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 +231 -205
  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.d.ts +15 -3
  80. package/dist/components/ModelSelector.js +1 -1
  81. package/dist/components/NaniteScene.d.ts +10 -1
  82. package/dist/components/NaniteScene.js +36 -1
  83. package/dist/components/Pricing.d.ts +37 -0
  84. package/dist/components/Pricing.js +17 -0
  85. package/dist/components/PricingBillingToggle.d.ts +23 -0
  86. package/dist/components/PricingBillingToggle.js +86 -0
  87. package/dist/components/PricingConfirmationDialog.d.ts +25 -0
  88. package/dist/components/PricingConfirmationDialog.js +57 -0
  89. package/dist/components/PricingFAQ.d.ts +18 -0
  90. package/dist/components/PricingFAQ.js +27 -0
  91. package/dist/components/PricingPage.d.ts +2 -38
  92. package/dist/components/PricingPage.js +39 -359
  93. package/dist/components/PricingPlanCard.d.ts +22 -0
  94. package/dist/components/PricingPlanCard.js +109 -0
  95. package/dist/components/PricingUsageCalculator.d.ts +22 -0
  96. package/dist/components/PricingUsageCalculator.js +96 -0
  97. package/dist/components/PromptInput.d.ts +2 -2
  98. package/dist/components/PromptInput.js +210 -15
  99. package/dist/components/Queue.js +1 -1
  100. package/dist/components/Reasoning.d.ts +2 -1
  101. package/dist/components/Reasoning.js +14 -29
  102. package/dist/components/ResizableSidePanel.d.ts +57 -0
  103. package/dist/components/ResizableSidePanel.js +151 -0
  104. package/dist/components/ResponsiveSidebarShell.d.ts +2 -0
  105. package/dist/components/ResponsiveSidebarShell.js +129 -0
  106. package/dist/components/Select.d.ts +2 -2
  107. package/dist/components/Select.js +11 -2
  108. package/dist/components/Slider.d.ts +13 -1
  109. package/dist/components/Slider.js +11 -0
  110. package/dist/components/Sources.js +1 -1
  111. package/dist/components/Stepper.d.ts +4 -0
  112. package/dist/components/Stepper.js +5 -3
  113. package/dist/components/SubagentRun.d.ts +86 -0
  114. package/dist/components/SubagentRun.js +108 -0
  115. package/dist/components/SubagentRunDetails.d.ts +44 -0
  116. package/dist/components/SubagentRunDetails.js +48 -0
  117. package/dist/components/SubagentRunIndicator.d.ts +22 -0
  118. package/dist/components/SubagentRunIndicator.js +33 -0
  119. package/dist/components/SubagentRunList.d.ts +25 -0
  120. package/dist/components/SubagentRunList.js +26 -0
  121. package/dist/components/SubagentRunSelector.d.ts +47 -0
  122. package/dist/components/SubagentRunSelector.js +55 -0
  123. package/dist/components/Task.js +1 -1
  124. package/dist/components/Terminal.js +2 -2
  125. package/dist/components/TestResults.js +1 -1
  126. package/dist/components/Textarea.d.ts +21 -0
  127. package/dist/components/Textarea.js +19 -0
  128. package/dist/components/ThemeModeControl.d.ts +24 -0
  129. package/dist/components/ThemeModeControl.js +52 -0
  130. package/dist/components/ThemeProvider.d.ts +38 -0
  131. package/dist/components/ThemeProvider.js +80 -0
  132. package/dist/components/ThinkChat.d.ts +34 -7
  133. package/dist/components/ThinkChat.js +7 -4
  134. package/dist/components/ThinkChatActivity.d.ts +3 -2
  135. package/dist/components/ThinkChatActivity.js +18 -297
  136. package/dist/components/ThinkChatActivitySummary.d.ts +2 -0
  137. package/dist/components/ThinkChatActivitySummary.js +421 -0
  138. package/dist/components/ThinkChatToolPanels.d.ts +15 -5
  139. package/dist/components/ThinkChatToolPanels.js +116 -9
  140. package/dist/components/ThinkChatToolParts.d.ts +2 -2
  141. package/dist/components/ThinkChatToolParts.js +51 -9
  142. package/dist/components/ThinkExecutionDetail.d.ts +20 -0
  143. package/dist/components/ThinkExecutionDetail.js +80 -0
  144. package/dist/components/ThinkExecutionRun.d.ts +2 -0
  145. package/dist/components/ThinkExecutionRun.js +72 -0
  146. package/dist/components/ThinkExecutionStatus.d.ts +22 -0
  147. package/dist/components/ThinkExecutionStatus.js +36 -0
  148. package/dist/components/ThinkExecutionWorkbench.d.ts +7 -0
  149. package/dist/components/ThinkExecutionWorkbench.js +69 -225
  150. package/dist/components/ThinkFullApp.d.ts +58 -14
  151. package/dist/components/ThinkFullApp.js +129 -160
  152. package/dist/components/ThinkFullAppViewSwitch.d.ts +31 -0
  153. package/dist/components/ThinkFullAppViewSwitch.js +34 -0
  154. package/dist/components/ThinkRoutine.d.ts +36 -0
  155. package/dist/components/ThinkRoutine.js +15 -0
  156. package/dist/components/ThinkRoutineBrowser.d.ts +25 -0
  157. package/dist/components/ThinkRoutineBrowser.js +156 -0
  158. package/dist/components/ThinkRoutineDetail.d.ts +24 -0
  159. package/dist/components/ThinkRoutineDetail.js +102 -0
  160. package/dist/components/ThinkRoutineForm.d.ts +32 -0
  161. package/dist/components/ThinkRoutineForm.js +151 -0
  162. package/dist/components/ThinkRoutineLibrary.d.ts +74 -0
  163. package/dist/components/ThinkRoutineLibrary.js +178 -0
  164. package/dist/components/ThinkRoutineRuns.d.ts +24 -0
  165. package/dist/components/ThinkRoutineRuns.js +68 -0
  166. package/dist/components/ThinkThreadPicker.d.ts +18 -1
  167. package/dist/components/ThinkThreadPicker.js +51 -5
  168. package/dist/components/ThinkThreadShell.d.ts +12 -9
  169. package/dist/components/ThinkThreadShell.js +17 -137
  170. package/dist/components/Toggle.d.ts +1 -68
  171. package/dist/components/ToggleGroup.d.ts +1 -72
  172. package/dist/components/Tooltip.d.ts +3 -1
  173. package/dist/components/Tooltip.js +4 -2
  174. package/dist/components/WebPreview.js +1 -1
  175. package/dist/components/Workspace.d.ts +2 -0
  176. package/dist/components/Workspace.js +424 -0
  177. package/dist/components/WorkspaceBrowser.d.ts +32 -0
  178. package/dist/components/WorkspaceBrowser.js +103 -0
  179. package/dist/components/WorkspaceExplorer.d.ts +12 -79
  180. package/dist/components/WorkspaceExplorer.js +116 -330
  181. package/dist/components/WorkspaceFile.d.ts +2 -0
  182. package/dist/components/WorkspaceFile.js +195 -0
  183. package/dist/components/WorkspaceFileView.d.ts +26 -0
  184. package/dist/components/WorkspaceFileView.js +2 -0
  185. package/dist/components/WorkspaceHeader.d.ts +35 -0
  186. package/dist/components/WorkspaceHeader.js +51 -0
  187. package/dist/components/WorkspaceLink.d.ts +2 -0
  188. package/dist/components/WorkspaceLink.js +2 -0
  189. package/dist/components/icons.d.ts +2 -2
  190. package/dist/components/icons.js +2 -2
  191. package/dist/{copy-button-DUMLYdsk.js → copy-button-Dejn5heL.js} +1 -1
  192. package/dist/icons-CpfUer49.js +85 -0
  193. package/dist/{icons-CUCz_Sft.d.ts → icons-GQd1xF4e.d.ts} +51 -1
  194. package/dist/styles/activity-header.css +75 -0
  195. package/dist/styles/activity.css +49 -63
  196. package/dist/styles/agent-activity-preview-overlay.css +80 -0
  197. package/dist/styles/agent-activity-preview.css +235 -0
  198. package/dist/styles/agent-attention.css +122 -0
  199. package/dist/styles/agent-chat.css +141 -4
  200. package/dist/styles/app-frame.css +15 -0
  201. package/dist/styles/app-top-bar.css +100 -0
  202. package/dist/styles/avatar.css +0 -1
  203. package/dist/styles/browser-control-overlay.css +184 -0
  204. package/dist/styles/card.css +21 -0
  205. package/dist/styles/checkbox-group.css +69 -0
  206. package/dist/styles/description-list.css +50 -0
  207. package/dist/styles/fieldset.css +11 -0
  208. package/dist/styles/index.css +15 -2
  209. package/dist/styles/mcp-connection-request.css +60 -0
  210. package/dist/styles/mcp-server-picker.css +95 -68
  211. package/dist/styles/message.css +4 -43
  212. package/dist/styles/nanite-scene.css +16 -0
  213. package/dist/styles/pricing-page.css +21 -27
  214. package/dist/styles/prompt-input.css +225 -32
  215. package/dist/styles/reasoning.css +1 -55
  216. package/dist/styles/recipes.css +23 -15
  217. package/dist/styles/resizable-side-panel.css +66 -0
  218. package/dist/styles/responsive-sidebar-shell.css +169 -0
  219. package/dist/styles/select.css +10 -0
  220. package/dist/styles/stepper.css +13 -0
  221. package/dist/styles/streamdown.css +0 -4
  222. package/dist/styles/subagent-run.css +205 -0
  223. package/dist/styles/textarea.css +20 -0
  224. package/dist/styles/theme-mode-control.css +72 -0
  225. package/dist/styles/think-execution-status.css +49 -0
  226. package/dist/styles/think-execution-workbench.css +8 -72
  227. package/dist/styles/think-full-app.css +106 -131
  228. package/dist/styles/think-routine-library.css +491 -0
  229. package/dist/styles/think-thread-picker.css +47 -3
  230. package/dist/styles/toggle-group.css +7 -0
  231. package/dist/styles/workspace-explorer.css +511 -64
  232. package/dist/utils/codex-model-catalog.d.ts +4 -4
  233. package/dist/utils/mcp-server-catalog.d.ts +82 -78
  234. package/dist/utils/mcp-server-catalog.js +64 -41
  235. package/dist/utils/structured-code.d.ts +1 -1
  236. package/dist/utils/theme.d.ts +22 -0
  237. package/dist/utils/theme.js +55 -0
  238. package/package.json +34 -28
  239. package/dist/icons-Ba9THQKz.js +0 -64
  240. package/dist/styles/think-resize-handle.css +0 -33
  241. package/dist/styles/think-thread-shell.css +0 -219
@@ -1,6 +1,36 @@
1
- import { getToolPartState } from "@cloudflare/think/react";
2
1
  import { getStaticToolName, getToolName, isReasoningUIPart, isStaticToolUIPart, isToolUIPart } from "ai";
3
2
  //#region src/components/ThinkChatToolParts.ts
3
+ /** React-free equivalent of Think's UI-state mapping. Kept local so activity
4
+ * summaries can run in workers and extension background contexts. */
5
+ function getToolPartState(part) {
6
+ if (!("state" in part)) return "loading";
7
+ switch (part.state) {
8
+ case "input-streaming": return "streaming";
9
+ case "approval-requested": return "waiting-approval";
10
+ case "approval-responded": return "approved";
11
+ case "output-available": return "complete";
12
+ case "output-error": return "error";
13
+ case "output-denied": return "denied";
14
+ default: return "loading";
15
+ }
16
+ }
17
+ /** Prefer AI SDK's provider/tool-authored title over its transport-facing key. */
18
+ function getToolDisplayName(part) {
19
+ return part.title ?? getToolName(part);
20
+ }
21
+ /**
22
+ * Whole-part supplement to Think's simplified state mapping. Think maps every
23
+ * `output-available` part to complete, while AI SDK preliminary outputs remain
24
+ * in flight until a non-preliminary result arrives.
25
+ */
26
+ function isToolPartWorking(part) {
27
+ const state = getToolPartState(part);
28
+ return state === "loading" || state === "streaming" || state === "waiting-approval" || state === "approved" || part.state === "output-available" && part.preliminary === true;
29
+ }
30
+ function isToolPartFailed(part) {
31
+ const state = getToolPartState(part);
32
+ return state === "error" || state === "denied";
33
+ }
4
34
  const WORKSPACE_TOOL_NAMES = /* @__PURE__ */ new Set([
5
35
  "read",
6
36
  "write",
@@ -22,6 +52,22 @@ const SKILL_TOOL_NAMES = /* @__PURE__ */ new Set([
22
52
  function isSkillToolPart(part) {
23
53
  return isStaticToolUIPart(part) && SKILL_TOOL_NAMES.has(getStaticToolName(part));
24
54
  }
55
+ const SESSION_CONTEXT_TOOL_NAMES = /* @__PURE__ */ new Set([
56
+ "set_context",
57
+ "load_context",
58
+ "unload_context",
59
+ "search_context",
60
+ "session_search"
61
+ ]);
62
+ function isSessionContextToolPart(part) {
63
+ return isStaticToolUIPart(part) && SESSION_CONTEXT_TOOL_NAMES.has(getStaticToolName(part));
64
+ }
65
+ /** Session tools report provider failures as successful string outputs so the
66
+ model can recover. Treat that upstream `Error:` envelope as failed UI while
67
+ preserving the recorded tool state and output verbatim. */
68
+ function isSessionContextToolFailure(part) {
69
+ return isPartFailed(part) || part.state === "output-available" && typeof part.output === "string" && part.output.startsWith("Error:");
70
+ }
25
71
  function isFetchToolPart(part) {
26
72
  return isStaticToolUIPart(part) && getStaticToolName(part).startsWith("fetch_");
27
73
  }
@@ -45,22 +91,18 @@ function isThinkChatActivityPart(part, excludeTools) {
45
91
  if (isToolUIPart(part) && excludeTools?.has(getToolName(part))) return false;
46
92
  return part.type === "step-start" || isReasoningUIPart(part) || isToolUIPart(part);
47
93
  }
48
- /** In-flight: the stream opened this part but hasn't delivered its result yet. */
94
+ /** In-flight: awaiting input, approval continuation, or a final tool result. */
49
95
  function isPartWorking(part) {
50
96
  if (isReasoningUIPart(part)) return part.state === "streaming";
51
- if (isToolUIPart(part)) {
52
- const state = getToolPartState(part);
53
- return state === "loading" || state === "streaming" || state === "waiting-approval";
54
- }
97
+ if (isToolUIPart(part)) return isToolPartWorking(part);
55
98
  return false;
56
99
  }
57
100
  /** Errored or denied — upstream's simplified tool-part state vocabulary. */
58
101
  function isPartFailed(part) {
59
- const state = getToolPartState(part);
60
- return state === "error" || state === "denied";
102
+ return isToolUIPart(part) && isToolPartFailed(part);
61
103
  }
62
104
  function displayUrl(url) {
63
105
  return url ? url.replace(/^https?:\/\//, "") : "";
64
106
  }
65
107
  //#endregion
66
- export { displayUrl, isBrowserToolPart, isExecuteToolPart, isFetchToolPart, isPartFailed, isPartWorking, isSkillToolPart, isThinkChatActivityPart, isWorkspaceToolPart };
108
+ export { displayUrl, getToolDisplayName, isBrowserToolPart, isExecuteToolPart, isFetchToolPart, isPartFailed, isPartWorking, isSessionContextToolFailure, isSessionContextToolPart, isSkillToolPart, isThinkChatActivityPart, isToolPartFailed, isToolPartWorking, isWorkspaceToolPart };
@@ -0,0 +1,20 @@
1
+ import { t as ThinkExecutionRun } from "../ThinkExecutionRun-ChhWhOoU.js";
2
+ import * as React from "react";
3
+
4
+ //#region src/components/ThinkExecutionDetail.d.ts
5
+ interface ThinkExecutionDetailProps extends React.HTMLAttributes<HTMLElement> {
6
+ run: ThinkExecutionRun | null;
7
+ emptyState?: React.ReactNode;
8
+ }
9
+ /** Native Think submission or Agents Workflow detail, reusable outside the execution workbench. */
10
+ declare function ThinkExecutionDetail({
11
+ className,
12
+ emptyState,
13
+ ref,
14
+ run,
15
+ ...props
16
+ }: ThinkExecutionDetailProps & {
17
+ ref?: React.Ref<HTMLElement>;
18
+ }): React.JSX.Element;
19
+ //#endregion
20
+ export { ThinkExecutionDetail, ThinkExecutionDetailProps };
@@ -0,0 +1,80 @@
1
+ import { t as cx } from "../class-names-9UtZwb0J.js";
2
+ import { G as TerminalIcon, L as RefreshIcon, S as InfoIcon, Y as XIcon, o as CheckIcon, t as ArrowDownIcon, v as FileIcon } from "../icons-CpfUer49.js";
3
+ import { Activity, ActivityContent, ActivityItem, ActivityItemGroup, ActivityOutput, ActivityPanel, ActivityTrigger } from "./Activity.js";
4
+ import { formatThinkExecutionRunProgress, formatThinkExecutionStatus, formatThinkExecutionTimestamp, getThinkExecutionRunError, getThinkExecutionRunId, getThinkExecutionRunProgressedAt, getThinkExecutionRunProgressedLabel, getThinkExecutionRunStatus, getThinkExecutionRunTitle, isThinkSubmissionRun } from "./ThinkExecutionRun.js";
5
+ import { ThinkExecutionStatus } from "./ThinkExecutionStatus.js";
6
+ import "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/components/ThinkExecutionDetail.tsx
9
+ function formatJson(value) {
10
+ return JSON.stringify(value, null, 2);
11
+ }
12
+ /** Native Think submission or Agents Workflow detail, reusable outside the execution workbench. */
13
+ function ThinkExecutionDetail({ className, emptyState = "Select a run to view its activity.", ref, run, ...props }) {
14
+ if (!run) return /* @__PURE__ */ jsx("section", {
15
+ ref,
16
+ className: cx("think-execution-detail", "think-execution-workbench__empty-detail", className),
17
+ role: "status",
18
+ ...props,
19
+ children: /* @__PURE__ */ jsx("p", { children: emptyState })
20
+ });
21
+ const id = getThinkExecutionRunId(run);
22
+ const progressedAt = getThinkExecutionRunProgressedAt(run);
23
+ const error = getThinkExecutionRunError(run);
24
+ return /* @__PURE__ */ jsxs("section", {
25
+ ref,
26
+ className: cx("think-execution-detail", className),
27
+ ...props,
28
+ children: [/* @__PURE__ */ jsxs("header", {
29
+ className: "think-execution-workbench__detail-header",
30
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", { children: getThinkExecutionRunTitle(run) }), !isThinkSubmissionRun(run) ? /* @__PURE__ */ jsx("code", { children: id }) : null] }), /* @__PURE__ */ jsxs("div", {
31
+ className: "think-execution-workbench__detail-status",
32
+ children: [/* @__PURE__ */ jsx(ThinkExecutionStatus, {
33
+ run,
34
+ className: "think-execution-workbench__icon"
35
+ }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("strong", { children: formatThinkExecutionStatus(getThinkExecutionRunStatus(run)) }), /* @__PURE__ */ jsx("span", { children: formatThinkExecutionRunProgress(run) })] })]
36
+ })]
37
+ }), /* @__PURE__ */ jsxs(Activity, {
38
+ defaultOpen: true,
39
+ children: [/* @__PURE__ */ jsx(ActivityTrigger, {
40
+ icon: /* @__PURE__ */ jsx(TerminalIcon, {}),
41
+ label: "Activity"
42
+ }), /* @__PURE__ */ jsxs(ActivityContent, { children: [
43
+ /* @__PURE__ */ jsx(ActivityItem, {
44
+ icon: /* @__PURE__ */ jsx(ArrowDownIcon, {}),
45
+ children: `Created ${formatThinkExecutionTimestamp(run.createdAt)}`
46
+ }),
47
+ progressedAt ? /* @__PURE__ */ jsx(ActivityItem, {
48
+ icon: /* @__PURE__ */ jsx(RefreshIcon, {}),
49
+ children: `${getThinkExecutionRunProgressedLabel(run)} ${formatThinkExecutionTimestamp(progressedAt)}`
50
+ }) : null,
51
+ run.completedAt ? /* @__PURE__ */ jsx(ActivityItem, {
52
+ icon: /* @__PURE__ */ jsx(CheckIcon, {}),
53
+ children: `Finished ${formatThinkExecutionTimestamp(run.completedAt)}`
54
+ }) : null,
55
+ error ? /* @__PURE__ */ jsx(ActivityItemGroup, {
56
+ icon: /* @__PURE__ */ jsx(XIcon, {}),
57
+ label: "Failure",
58
+ children: /* @__PURE__ */ jsx(ActivityPanel, {
59
+ label: "Error",
60
+ text: error,
61
+ status: "error",
62
+ error: true
63
+ })
64
+ }) : null,
65
+ run.metadata ? /* @__PURE__ */ jsx(ActivityItemGroup, {
66
+ icon: /* @__PURE__ */ jsx(InfoIcon, {}),
67
+ label: "Metadata",
68
+ children: /* @__PURE__ */ jsx(ActivityOutput, { children: formatJson(run.metadata) })
69
+ }) : null,
70
+ /* @__PURE__ */ jsx(ActivityItemGroup, {
71
+ icon: /* @__PURE__ */ jsx(FileIcon, {}),
72
+ label: "Raw record",
73
+ children: /* @__PURE__ */ jsx(ActivityOutput, { children: formatJson(run) })
74
+ })
75
+ ] })]
76
+ })]
77
+ });
78
+ }
79
+ //#endregion
80
+ export { ThinkExecutionDetail };
@@ -0,0 +1,2 @@
1
+ import { _ as isThinkSubmissionRun, a as formatThinkExecutionStatus, c as getThinkExecutionRunError, d as getThinkExecutionRunProgressedLabel, f as getThinkExecutionRunStatus, g as isSameThinkExecutionRun, h as getThinkExecutionRunTitle, i as formatThinkExecutionShortTimestamp, l as getThinkExecutionRunId, m as getThinkExecutionRunSubtitle, n as ThinkExecutionStatusTone, o as formatThinkExecutionTimestamp, p as getThinkExecutionRunStatusTone, r as formatThinkExecutionRunProgress, s as getThinkExecutionRunAccessibleName, t as ThinkExecutionRun, u as getThinkExecutionRunProgressedAt } from "../ThinkExecutionRun-ChhWhOoU.js";
2
+ export { ThinkExecutionRun, ThinkExecutionStatusTone, formatThinkExecutionRunProgress, formatThinkExecutionShortTimestamp, formatThinkExecutionStatus, formatThinkExecutionTimestamp, getThinkExecutionRunAccessibleName, getThinkExecutionRunError, getThinkExecutionRunId, getThinkExecutionRunProgressedAt, getThinkExecutionRunProgressedLabel, getThinkExecutionRunStatus, getThinkExecutionRunStatusTone, getThinkExecutionRunSubtitle, getThinkExecutionRunTitle, isSameThinkExecutionRun, isThinkSubmissionRun };
@@ -0,0 +1,72 @@
1
+ //#region src/components/ThinkExecutionRun.ts
2
+ /** Narrows the direct upstream execution union without wrapping either record. */
3
+ function isThinkSubmissionRun(run) {
4
+ return "submissionId" in run;
5
+ }
6
+ function getThinkExecutionRunId(run) {
7
+ return isThinkSubmissionRun(run) ? run.submissionId : run.workflowId;
8
+ }
9
+ function getThinkExecutionRunTitle(run) {
10
+ return isThinkSubmissionRun(run) ? run.submissionId : run.workflowName;
11
+ }
12
+ function getThinkExecutionRunSubtitle(run) {
13
+ return isThinkSubmissionRun(run) ? void 0 : run.workflowId;
14
+ }
15
+ function getThinkExecutionRunProgressedAt(run) {
16
+ return isThinkSubmissionRun(run) ? run.startedAt : run.updatedAt;
17
+ }
18
+ function getThinkExecutionRunProgressedLabel(run) {
19
+ return isThinkSubmissionRun(run) ? "Started" : "Updated";
20
+ }
21
+ /**
22
+ * WorkflowInfo.status resolves through the Workers-only InstanceStatus ambient
23
+ * type, so browser consumers format the whole upstream record's runtime value
24
+ * instead of exporting a local mirror of that union.
25
+ */
26
+ function getThinkExecutionRunStatus(run) {
27
+ return String(run.status);
28
+ }
29
+ function getThinkExecutionRunStatusTone(run) {
30
+ const status = getThinkExecutionRunStatus(run);
31
+ if (status === "completed" || status === "complete") return "success";
32
+ if (status === "error" || status === "errored" || status === "terminated") return "danger";
33
+ if (status === "aborted" || status === "skipped" || status === "paused" || status === "waiting") return "warning";
34
+ if (status === "running" || status === "pending" || status === "queued" || status === "waitingForPause" || status === "rollingBack") return "primary";
35
+ return "neutral";
36
+ }
37
+ function formatThinkExecutionStatus(status) {
38
+ const words = status.replaceAll(/([a-z])([A-Z])/g, "$1 $2");
39
+ return words.charAt(0).toUpperCase() + words.slice(1);
40
+ }
41
+ function formatThinkExecutionTimestamp(value, fallback = "Not recorded") {
42
+ if (value == null) return fallback;
43
+ const date = value instanceof Date ? value : new Date(value);
44
+ return Number.isNaN(date.getTime()) ? fallback : date.toLocaleString();
45
+ }
46
+ function formatThinkExecutionShortTimestamp(value, fallback = "Not recorded") {
47
+ if (value == null) return fallback;
48
+ const date = value instanceof Date ? value : new Date(value);
49
+ return Number.isNaN(date.getTime()) ? fallback : date.toLocaleString(void 0, {
50
+ month: "short",
51
+ day: "numeric",
52
+ hour: "numeric",
53
+ minute: "2-digit"
54
+ });
55
+ }
56
+ function formatThinkExecutionRunProgress(run) {
57
+ const progressedAt = getThinkExecutionRunProgressedAt(run);
58
+ return `${progressedAt ? getThinkExecutionRunProgressedLabel(run) : "Created"} ${formatThinkExecutionShortTimestamp(progressedAt ?? run.createdAt)}`;
59
+ }
60
+ function getThinkExecutionRunAccessibleName(run) {
61
+ const subtitle = getThinkExecutionRunSubtitle(run);
62
+ return `${getThinkExecutionRunTitle(run)}${subtitle ? ` ${subtitle}` : ""}. ${formatThinkExecutionStatus(getThinkExecutionRunStatus(run))}. ${formatThinkExecutionRunProgress(run)}`;
63
+ }
64
+ function getThinkExecutionRunError(run) {
65
+ return isThinkSubmissionRun(run) ? run.error : run.error ? `${run.error.name}: ${run.error.message}` : void 0;
66
+ }
67
+ function isSameThinkExecutionRun(first, second) {
68
+ if (!first || isThinkSubmissionRun(first) !== isThinkSubmissionRun(second)) return false;
69
+ return getThinkExecutionRunId(first) === getThinkExecutionRunId(second);
70
+ }
71
+ //#endregion
72
+ export { formatThinkExecutionRunProgress, formatThinkExecutionShortTimestamp, formatThinkExecutionStatus, formatThinkExecutionTimestamp, getThinkExecutionRunAccessibleName, getThinkExecutionRunError, getThinkExecutionRunId, getThinkExecutionRunProgressedAt, getThinkExecutionRunProgressedLabel, getThinkExecutionRunStatus, getThinkExecutionRunStatusTone, getThinkExecutionRunSubtitle, getThinkExecutionRunTitle, isSameThinkExecutionRun, isThinkSubmissionRun };
@@ -0,0 +1,22 @@
1
+ import { t as ThinkExecutionRun } from "../ThinkExecutionRun-ChhWhOoU.js";
2
+ import * as React from "react";
3
+
4
+ //#region src/components/ThinkExecutionStatus.d.ts
5
+ interface ThinkExecutionStatusProps extends React.HTMLAttributes<HTMLSpanElement> {
6
+ /** Whole upstream Think submission or Agents workflow record. */
7
+ run: ThinkExecutionRun;
8
+ /** Accessible status label; derived from the run when omitted. */
9
+ label?: string;
10
+ }
11
+ /** Shared status icon for whole upstream Think submission and Agents workflow records. */
12
+ declare function ThinkExecutionStatus({
13
+ className,
14
+ label,
15
+ run,
16
+ ref,
17
+ ...props
18
+ }: ThinkExecutionStatusProps & {
19
+ ref?: React.Ref<HTMLSpanElement>;
20
+ }): React.JSX.Element;
21
+ //#endregion
22
+ export { ThinkExecutionStatus, ThinkExecutionStatusProps };
@@ -0,0 +1,36 @@
1
+ import { t as cx } from "../class-names-9UtZwb0J.js";
2
+ import { B as SpinnerIcon, M as PauseIcon, S as InfoIcon, Y as XIcon, o as CheckIcon } from "../icons-CpfUer49.js";
3
+ import { Tooltip } from "./Tooltip.js";
4
+ import { formatThinkExecutionStatus, getThinkExecutionRunStatus, getThinkExecutionRunStatusTone } from "./ThinkExecutionRun.js";
5
+ import "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/components/ThinkExecutionStatus.tsx
8
+ function statusIcon(tone) {
9
+ if (tone === "success") return /* @__PURE__ */ jsx(CheckIcon, {});
10
+ if (tone === "danger") return /* @__PURE__ */ jsx(XIcon, {});
11
+ if (tone === "warning") return /* @__PURE__ */ jsx(PauseIcon, {});
12
+ if (tone === "primary") return /* @__PURE__ */ jsx(SpinnerIcon, {});
13
+ return /* @__PURE__ */ jsx(InfoIcon, {});
14
+ }
15
+ /** Shared status icon for whole upstream Think submission and Agents workflow records. */
16
+ function ThinkExecutionStatus({ className, label, run, ref, ...props }) {
17
+ const status = getThinkExecutionRunStatus(run);
18
+ const tone = getThinkExecutionRunStatusTone(run);
19
+ const accessibleLabel = label ?? `Status: ${formatThinkExecutionStatus(status)}`;
20
+ return /* @__PURE__ */ jsxs(Tooltip.Root, { children: [/* @__PURE__ */ jsx(Tooltip.Trigger, { render: /* @__PURE__ */ jsx("span", {
21
+ ref,
22
+ "aria-label": accessibleLabel,
23
+ className: cx("think-execution-status", className),
24
+ "data-status": status,
25
+ "data-tone": tone,
26
+ role: "img",
27
+ ...props,
28
+ children: statusIcon(tone)
29
+ }) }), /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
30
+ side: "top",
31
+ sideOffset: 6,
32
+ children: /* @__PURE__ */ jsx(Tooltip.Popup, { children: accessibleLabel })
33
+ }) })] });
34
+ }
35
+ //#endregion
36
+ export { ThinkExecutionStatus };
@@ -1,3 +1,4 @@
1
+ import { t as ThinkExecutionRun } from "../ThinkExecutionRun-ChhWhOoU.js";
1
2
  import * as React from "react";
2
3
  import { Think } from "@cloudflare/think";
3
4
  import { AgentStub } from "agents/client";
@@ -9,6 +10,10 @@ interface ThinkExecutionWorkbenchProps extends Omit<React.HTMLAttributes<HTMLDiv
9
10
  title?: React.ReactNode;
10
11
  backButton?: React.ReactNode;
11
12
  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;
12
17
  }
13
18
  /**
14
19
  * Unified execution history for native Think submissions and Agents workflows.
@@ -18,8 +23,10 @@ interface ThinkExecutionWorkbenchProps extends Omit<React.HTMLAttributes<HTMLDiv
18
23
  declare function ThinkExecutionWorkbench({
19
24
  backButton,
20
25
  className,
26
+ onSelectedRunChange,
21
27
  pageSize,
22
28
  ref,
29
+ selectedRun: controlledSelectedRun,
23
30
  source,
24
31
  title,
25
32
  ...props