@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,181 +1,26 @@
1
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { A as RefreshIcon, E as PauseIcon, I as TerminalIcon, N as SpinnerIcon, a as CheckIcon, f as EllipsisIcon, h as FileIcon, t as ArrowDownIcon, y as InfoIcon, z as XIcon } from "../icons-Ba9THQKz.js";
3
- import { Activity, ActivityContent, ActivityItem, ActivityItemGroup, ActivityOutput, ActivityPanel, ActivityTrigger } from "./Activity.js";
2
+ import { L as RefreshIcon, h as EllipsisIcon } from "../icons-CpfUer49.js";
4
3
  import { Button } from "./Button.js";
5
4
  import { Tooltip } from "./Tooltip.js";
6
5
  import { Menu } from "./Menu.js";
6
+ import { AppTopBar } from "./AppTopBar.js";
7
+ import { formatThinkExecutionRunProgress, getThinkExecutionRunAccessibleName, getThinkExecutionRunId, getThinkExecutionRunStatus, getThinkExecutionRunStatusTone, getThinkExecutionRunSubtitle, getThinkExecutionRunTitle, isSameThinkExecutionRun, isThinkSubmissionRun } from "./ThinkExecutionRun.js";
8
+ import { ThinkExecutionStatus } from "./ThinkExecutionStatus.js";
9
+ import { ThinkExecutionDetail } from "./ThinkExecutionDetail.js";
7
10
  import * as React from "react";
8
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
12
  //#region src/components/ThinkExecutionWorkbench.tsx
10
13
  const executionPanelPageSize = 20;
11
- function formatTimestamp(value) {
12
- if (value == null) return "Not recorded";
13
- const date = value instanceof Date ? value : new Date(value);
14
- return Number.isNaN(date.getTime()) ? "Not recorded" : date.toLocaleString();
15
- }
16
- function formatShortTimestamp(value) {
17
- if (value == null) return "Not recorded";
18
- const date = value instanceof Date ? value : new Date(value);
19
- return Number.isNaN(date.getTime()) ? "Not recorded" : date.toLocaleString(void 0, {
20
- month: "short",
21
- day: "numeric",
22
- hour: "numeric",
23
- minute: "2-digit"
24
- });
25
- }
26
- function formatJson(value) {
27
- return JSON.stringify(value, null, 2);
28
- }
29
14
  function getErrorMessage(error) {
30
15
  return error instanceof Error ? error.message : String(error);
31
16
  }
32
- function TooltipIcon({ children, className, label, status, tone }) {
33
- return /* @__PURE__ */ jsxs(Tooltip.Root, { children: [/* @__PURE__ */ jsx(Tooltip.Trigger, { render: /* @__PURE__ */ jsx("span", {
34
- "aria-label": label,
35
- className: cx("think-execution-workbench__icon", className),
36
- "data-status": status,
37
- "data-tone": tone,
38
- role: "img",
39
- children
40
- }) }), /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
41
- side: "top",
42
- sideOffset: 6,
43
- children: /* @__PURE__ */ jsx(Tooltip.Popup, { children: label })
44
- }) })] });
45
- }
46
- function runId(run) {
47
- return run.kind === "submission" ? run.record.submissionId : run.record.workflowId;
48
- }
49
- function runTitle(run) {
50
- return run.kind === "submission" ? run.record.submissionId : run.record.workflowName;
51
- }
52
- function runSubtitle(run) {
53
- return run.kind === "workflow" ? run.record.workflowId : void 0;
54
- }
55
- function runCreatedAt(run) {
56
- return run.record.createdAt;
57
- }
58
- function runProgressedAt(run) {
59
- return run.kind === "submission" ? run.record.startedAt : run.record.updatedAt;
60
- }
61
- function runProgressedLabel(run) {
62
- return run.kind === "submission" ? "Started" : "Updated";
63
- }
64
- function runCompletedAt(run) {
65
- return run.record.completedAt;
66
- }
67
- function runStatus(run) {
68
- return String(run.record.status);
69
- }
70
- function formatStatus(status) {
71
- return status.charAt(0).toUpperCase() + status.slice(1);
72
- }
73
- function runListTimestamp(run) {
74
- const progressedAt = runProgressedAt(run);
75
- return `${progressedAt ? runProgressedLabel(run) : "Created"} ${formatShortTimestamp(progressedAt ?? runCreatedAt(run))}`;
76
- }
77
- function runAccessibleName(run) {
78
- const subtitle = runSubtitle(run);
79
- return `${runTitle(run)}${subtitle ? ` ${subtitle}` : ""}. ${formatStatus(runStatus(run))}. ${runListTimestamp(run)}`;
80
- }
81
- function runStatusTone(run) {
82
- const status = runStatus(run);
83
- if (status === "completed" || status === "complete") return "success";
84
- if (status === "error" || status === "errored" || status === "terminated") return "danger";
85
- if (status === "aborted" || status === "skipped" || status === "paused" || status === "waiting") return "warning";
86
- if (status === "running") return "primary";
87
- return "neutral";
88
- }
89
- function RunStatus({ run }) {
90
- const status = runStatus(run);
91
- const icon = status === "completed" || status === "complete" ? /* @__PURE__ */ jsx(CheckIcon, {}) : status === "error" || status === "errored" || status === "terminated" ? /* @__PURE__ */ jsx(XIcon, {}) : status === "aborted" || status === "skipped" || status === "paused" || status === "waiting" ? /* @__PURE__ */ jsx(PauseIcon, {}) : status === "running" ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : /* @__PURE__ */ jsx(InfoIcon, {});
92
- return /* @__PURE__ */ jsx(TooltipIcon, {
93
- className: "think-execution-workbench__status",
94
- label: `Status: ${status}`,
95
- status,
96
- tone: runStatusTone(run),
97
- children: icon
98
- });
99
- }
100
- function runMetadata(run) {
101
- return run.record.metadata;
102
- }
103
- function runError(run) {
104
- return run.kind === "submission" ? run.record.error : run.record.error ? `${run.record.error.name}: ${run.record.error.message}` : void 0;
105
- }
106
- function isSameRun(first, second) {
107
- return first?.kind === second.kind && runId(first) === runId(second);
108
- }
109
17
  function isSubmissionCancelable(status) {
110
18
  return status === "pending" || status === "running";
111
19
  }
112
- function isWorkflowTerminal(status) {
113
- const value = String(status);
114
- return value === "complete" || value === "errored" || value === "terminated";
115
- }
116
- function RunActivity({ run }) {
117
- const progressedAt = runProgressedAt(run);
118
- const completedAt = runCompletedAt(run);
119
- const error = runError(run);
120
- const metadata = runMetadata(run);
121
- return /* @__PURE__ */ jsxs(Activity, {
122
- defaultOpen: true,
123
- children: [/* @__PURE__ */ jsx(ActivityTrigger, {
124
- icon: /* @__PURE__ */ jsx(TerminalIcon, {}),
125
- label: "Activity"
126
- }), /* @__PURE__ */ jsxs(ActivityContent, { children: [
127
- /* @__PURE__ */ jsx(ActivityItem, {
128
- icon: /* @__PURE__ */ jsx(ArrowDownIcon, {}),
129
- children: `Created ${formatTimestamp(runCreatedAt(run))}`
130
- }),
131
- progressedAt ? /* @__PURE__ */ jsx(ActivityItem, {
132
- icon: /* @__PURE__ */ jsx(RefreshIcon, {}),
133
- children: `${runProgressedLabel(run)} ${formatTimestamp(progressedAt)}`
134
- }) : null,
135
- completedAt ? /* @__PURE__ */ jsx(ActivityItem, {
136
- icon: /* @__PURE__ */ jsx(CheckIcon, {}),
137
- children: `Finished ${formatTimestamp(completedAt)}`
138
- }) : null,
139
- error ? /* @__PURE__ */ jsx(ActivityItemGroup, {
140
- icon: /* @__PURE__ */ jsx(XIcon, {}),
141
- label: "Failure",
142
- children: /* @__PURE__ */ jsx(ActivityPanel, {
143
- label: "Error",
144
- text: error,
145
- status: "error",
146
- error: true
147
- })
148
- }) : null,
149
- metadata ? /* @__PURE__ */ jsx(ActivityItemGroup, {
150
- icon: /* @__PURE__ */ jsx(InfoIcon, {}),
151
- label: "Metadata",
152
- children: /* @__PURE__ */ jsx(ActivityOutput, { children: formatJson(metadata) })
153
- }) : null,
154
- /* @__PURE__ */ jsx(ActivityItemGroup, {
155
- icon: /* @__PURE__ */ jsx(FileIcon, {}),
156
- label: "Raw record",
157
- children: /* @__PURE__ */ jsx(ActivityOutput, { children: formatJson(run.record) })
158
- })
159
- ] })]
160
- });
161
- }
162
- function RunDetail({ run }) {
163
- if (!run) return /* @__PURE__ */ jsx("div", {
164
- className: "think-execution-workbench__empty-detail",
165
- role: "status",
166
- children: /* @__PURE__ */ jsx("p", { children: "Select a run to view its activity." })
167
- });
168
- const id = runId(run);
169
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("header", {
170
- className: "think-execution-workbench__detail-header",
171
- children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", { children: runTitle(run) }), run.kind === "workflow" ? /* @__PURE__ */ jsx("code", { children: id }) : null] }), /* @__PURE__ */ jsxs("div", {
172
- className: "think-execution-workbench__detail-status",
173
- children: [/* @__PURE__ */ jsx(RunStatus, { run }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("strong", { children: formatStatus(runStatus(run)) }), /* @__PURE__ */ jsx("span", { children: runListTimestamp(run) })] })]
174
- })]
175
- }), /* @__PURE__ */ jsx(RunActivity, { run })] });
176
- }
177
20
  function RunActions({ busy, onAction, run, source }) {
178
- const id = runId(run);
21
+ const id = getThinkExecutionRunId(run);
22
+ const statusTone = getThinkExecutionRunStatusTone(run);
23
+ const kind = isThinkSubmissionRun(run) ? "submission" : "workflow";
179
24
  const action = (key, callback) => () => onAction(key, callback);
180
25
  return /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsxs(Tooltip.Root, { children: [/* @__PURE__ */ jsx(Tooltip.Trigger, { render: /* @__PURE__ */ jsx(Menu.Trigger, {
181
26
  unstyled: true,
@@ -185,7 +30,7 @@ function RunActions({ busy, onAction, run, source }) {
185
30
  color: "neutral",
186
31
  size: "icon-xs",
187
32
  className: "think-execution-workbench__run-actions",
188
- "aria-label": `Actions for ${run.kind} ${id}`,
33
+ "aria-label": `Actions for ${kind} ${id}`,
189
34
  disabled: busy,
190
35
  children: /* @__PURE__ */ jsx(EllipsisIcon, {})
191
36
  })
@@ -195,8 +40,8 @@ function RunActions({ busy, onAction, run, source }) {
195
40
  children: /* @__PURE__ */ jsx(Tooltip.Popup, { children: "Run actions" })
196
41
  }) })] }), /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
197
42
  align: "end",
198
- children: /* @__PURE__ */ jsx(Menu.Popup, { children: run.kind === "submission" ? /* @__PURE__ */ jsxs(Fragment, { children: [
199
- isSubmissionCancelable(run.record.status) ? /* @__PURE__ */ jsx(Menu.Item, {
43
+ children: /* @__PURE__ */ jsx(Menu.Popup, { children: isThinkSubmissionRun(run) ? /* @__PURE__ */ jsxs(Fragment, { children: [
44
+ isSubmissionCancelable(run.status) ? /* @__PURE__ */ jsx(Menu.Item, {
200
45
  disabled: busy,
201
46
  onClick: action(`cancel-submission:${id}`, () => source.cancelSubmission(id)),
202
47
  children: "Cancel"
@@ -211,25 +56,25 @@ function RunActions({ busy, onAction, run, source }) {
211
56
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
212
57
  /* @__PURE__ */ jsx(Menu.Item, {
213
58
  disabled: busy,
214
- onClick: action(`sync-workflow:${id}`, () => source.getWorkflowStatus(run.record.workflowName, id)),
59
+ onClick: action(`sync-workflow:${id}`, () => source.getWorkflowStatus(run.workflowName, id)),
215
60
  children: "Refresh status"
216
61
  }),
217
- runStatus(run) === "running" ? /* @__PURE__ */ jsx(Menu.Item, {
62
+ getThinkExecutionRunStatus(run) === "running" ? /* @__PURE__ */ jsx(Menu.Item, {
218
63
  disabled: busy,
219
64
  onClick: action(`pause-workflow:${id}`, () => source.pauseWorkflow(id)),
220
65
  children: "Pause"
221
66
  }) : null,
222
- runStatus(run) === "paused" ? /* @__PURE__ */ jsx(Menu.Item, {
67
+ getThinkExecutionRunStatus(run) === "paused" ? /* @__PURE__ */ jsx(Menu.Item, {
223
68
  disabled: busy,
224
69
  onClick: action(`resume-workflow:${id}`, () => source.resumeWorkflow(id)),
225
70
  children: "Resume"
226
71
  }) : null,
227
- isWorkflowTerminal(run.record.status) ? /* @__PURE__ */ jsx(Menu.Item, {
72
+ statusTone === "success" || statusTone === "danger" ? /* @__PURE__ */ jsx(Menu.Item, {
228
73
  disabled: busy,
229
74
  onClick: action(`restart-workflow:${id}`, () => source.restartWorkflow(id)),
230
75
  children: "Restart"
231
76
  }) : null,
232
- runStatus(run) === "running" ? /* @__PURE__ */ jsx(Menu.Item, {
77
+ getThinkExecutionRunStatus(run) === "running" ? /* @__PURE__ */ jsx(Menu.Item, {
233
78
  disabled: busy,
234
79
  variant: "destructive",
235
80
  onClick: action(`terminate-workflow:${id}`, () => source.terminateWorkflow(id)),
@@ -250,7 +95,7 @@ function RunActions({ busy, onAction, run, source }) {
250
95
  * The workbench reads and acts through the whole upstream agent stub; it does
251
96
  * not normalize execution records or own workflow authoring.
252
97
  */
253
- function ThinkExecutionWorkbench({ backButton, className, pageSize = executionPanelPageSize, ref, source, title = "Execution", ...props }) {
98
+ function ThinkExecutionWorkbench({ backButton, className, onSelectedRunChange, pageSize = executionPanelPageSize, ref, selectedRun: controlledSelectedRun, source, title = "Execution", ...props }) {
254
99
  const runsId = React.useId();
255
100
  const activeSourceRef = React.useRef(source);
256
101
  const sourceGenerationRef = React.useRef(0);
@@ -260,14 +105,9 @@ function ThinkExecutionWorkbench({ backButton, className, pageSize = executionPa
260
105
  const [executionData, setExecutionData] = React.useState(null);
261
106
  const [selection, setSelection] = React.useState(null);
262
107
  const activeExecutionData = executionData?.source === source ? executionData : null;
263
- const selectedRun = selection?.source === source ? selection.run : null;
264
- const runs = React.useMemo(() => [...activeExecutionData?.submissions.map((record) => ({
265
- kind: "submission",
266
- record
267
- })) ?? [], ...activeExecutionData?.workflows.workflows.map((record) => ({
268
- kind: "workflow",
269
- record
270
- })) ?? []].sort((first, second) => Number(runCreatedAt(second)) - Number(runCreatedAt(first))), [activeExecutionData]);
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]);
271
111
  const isCurrentOperation = React.useCallback((operation) => activeSourceRef.current === operation.source && sourceGenerationRef.current === operation.generation && operationSequenceRef.current === operation.sequence, []);
272
112
  const beginOperation = React.useCallback(() => {
273
113
  if (activeSourceRef.current !== source) return null;
@@ -328,30 +168,34 @@ function ThinkExecutionWorkbench({ backButton, className, pageSize = executionPa
328
168
  loadData
329
169
  ]);
330
170
  const selectRun = React.useCallback((run) => {
331
- runAction(`select-${run.kind}:${runId(run)}`, async (operation) => {
332
- if (run.kind === "submission") {
333
- const inspection = await operation.source.inspectSubmission(run.record.submissionId);
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);
334
175
  if (!isCurrentOperation(operation)) return;
335
- setSelection({
176
+ const selected = inspection ?? run;
177
+ if (controlledSelectedRun === void 0) setSelection({
336
178
  source: operation.source,
337
- run: inspection ? {
338
- kind: "submission",
339
- record: inspection
340
- } : run
179
+ run: selected
341
180
  });
181
+ onSelectedRunChange?.(selected);
342
182
  return;
343
183
  }
344
- const workflow = await operation.source.getWorkflow(run.record.workflowId);
184
+ const workflow = await operation.source.getWorkflow(run.workflowId);
345
185
  if (!isCurrentOperation(operation)) return;
346
- setSelection({
186
+ const selected = workflow ?? run;
187
+ if (controlledSelectedRun === void 0) setSelection({
347
188
  source: operation.source,
348
- run: workflow ? {
349
- kind: "workflow",
350
- record: workflow
351
- } : run
189
+ run: selected
352
190
  });
191
+ onSelectedRunChange?.(selected);
353
192
  });
354
- }, [isCurrentOperation, runAction]);
193
+ }, [
194
+ controlledSelectedRun,
195
+ isCurrentOperation,
196
+ onSelectedRunChange,
197
+ runAction
198
+ ]);
355
199
  React.useLayoutEffect(() => {
356
200
  activeSourceRef.current = source;
357
201
  sourceGenerationRef.current += 1;
@@ -375,29 +219,22 @@ function ThinkExecutionWorkbench({ backButton, className, pageSize = executionPa
375
219
  className: cx("think-execution-workbench", className),
376
220
  ...props,
377
221
  children: [
378
- /* @__PURE__ */ jsxs("header", {
222
+ /* @__PURE__ */ jsxs(AppTopBar.Root, {
379
223
  className: "think-execution-workbench__header",
380
- children: [/* @__PURE__ */ jsxs("div", {
381
- className: "think-execution-workbench__heading",
382
- children: [backButton, /* @__PURE__ */ jsx("h2", {
224
+ "aria-label": "Run controls",
225
+ children: [
226
+ /* @__PURE__ */ jsx(AppTopBar.Leading, { children: backButton }),
227
+ /* @__PURE__ */ jsx(AppTopBar.Title, { children: /* @__PURE__ */ jsx("h2", {
383
228
  className: "think-execution-workbench__title",
384
229
  children: title
385
- })]
386
- }), /* @__PURE__ */ jsxs(Tooltip.Root, { children: [/* @__PURE__ */ jsx(Tooltip.Trigger, { render: /* @__PURE__ */ jsx(Button, {
387
- type: "button",
388
- variant: "ghost",
389
- color: "neutral",
390
- size: "icon-xs",
391
- className: "think-execution-workbench__refresh",
392
- "aria-label": "Refresh runs",
393
- disabled: busyAction !== null,
394
- onClick: () => void refresh(),
395
- children: /* @__PURE__ */ jsx(RefreshIcon, {})
396
- }) }), /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
397
- side: "bottom",
398
- sideOffset: 6,
399
- children: /* @__PURE__ */ jsx(Tooltip.Popup, { children: "Refresh runs" })
400
- }) })] })]
230
+ }) }),
231
+ /* @__PURE__ */ jsx(AppTopBar.Trailing, { children: /* @__PURE__ */ jsx(AppTopBar.Button, {
232
+ label: "Refresh runs",
233
+ disabled: busyAction !== null,
234
+ onClick: () => void refresh(),
235
+ children: /* @__PURE__ */ jsx(RefreshIcon, {})
236
+ }) })
237
+ ]
401
238
  }),
402
239
  error ? /* @__PURE__ */ jsx("div", {
403
240
  className: "think-execution-workbench__error",
@@ -427,28 +264,35 @@ function ThinkExecutionWorkbench({ backButton, className, pageSize = executionPa
427
264
  className: "think-execution-workbench__list",
428
265
  role: "list",
429
266
  children: runs.map((run) => {
430
- const id = runId(run);
431
- const selected = isSameRun(selectedRun, run);
267
+ const id = getThinkExecutionRunId(run);
268
+ const kind = isThinkSubmissionRun(run) ? "submission" : "workflow";
269
+ const selected = isSameThinkExecutionRun(selectedRun, run);
432
270
  return /* @__PURE__ */ jsxs("li", {
433
271
  "data-selected": selected || void 0,
434
- children: [/* @__PURE__ */ jsxs("button", {
272
+ children: [/* @__PURE__ */ jsxs(Button, {
435
273
  type: "button",
274
+ variant: "ghost",
275
+ color: "neutral",
276
+ size: "sm",
436
277
  className: "think-execution-workbench__run",
437
- "aria-label": runAccessibleName(run),
278
+ "aria-label": getThinkExecutionRunAccessibleName(run),
438
279
  "aria-current": selected ? "page" : void 0,
439
280
  disabled: busyAction !== null,
440
281
  onClick: () => selectRun(run),
441
- children: [/* @__PURE__ */ jsx(RunStatus, { run }), /* @__PURE__ */ jsxs("span", {
282
+ children: [/* @__PURE__ */ jsx(ThinkExecutionStatus, {
283
+ run,
284
+ className: "think-execution-workbench__icon"
285
+ }), /* @__PURE__ */ jsxs("span", {
442
286
  className: "think-execution-workbench__run-copy",
443
287
  children: [/* @__PURE__ */ jsxs("span", {
444
288
  className: "think-execution-workbench__run-heading",
445
289
  children: [/* @__PURE__ */ jsx("span", {
446
290
  className: "think-execution-workbench__run-title",
447
- children: runTitle(run)
448
- }), runSubtitle(run) ? /* @__PURE__ */ jsx("code", { children: runSubtitle(run) }) : null]
291
+ children: getThinkExecutionRunTitle(run)
292
+ }), getThinkExecutionRunSubtitle(run) ? /* @__PURE__ */ jsx("code", { children: getThinkExecutionRunSubtitle(run) }) : null]
449
293
  }), /* @__PURE__ */ jsx("span", {
450
294
  className: "think-execution-workbench__run-summary",
451
- children: runListTimestamp(run)
295
+ children: formatThinkExecutionRunProgress(run)
452
296
  })]
453
297
  })]
454
298
  }), /* @__PURE__ */ jsx(RunActions, {
@@ -457,13 +301,13 @@ function ThinkExecutionWorkbench({ backButton, className, pageSize = executionPa
457
301
  source,
458
302
  onAction: (key, action) => void runAction(key, () => action())
459
303
  })]
460
- }, `${run.kind}:${id}`);
304
+ }, `${kind}:${id}`);
461
305
  })
462
306
  })]
463
307
  }), /* @__PURE__ */ jsx("section", {
464
308
  className: "think-execution-workbench__detail",
465
309
  "aria-label": "Run detail",
466
- children: /* @__PURE__ */ jsx(RunDetail, { run: selectedRun })
310
+ children: /* @__PURE__ */ jsx(ThinkExecutionDetail, { run: selectedRun })
467
311
  })]
468
312
  })
469
313
  ]
@@ -1,5 +1,11 @@
1
- import { WorkspaceSource } from "./WorkspaceExplorer.js";
1
+ import { l as WorkspaceNavigationAdapter } from "../WorkspaceLink-DK1DWMHe.js";
2
+ import { r as WorkspaceFileAssetResolver } from "../WorkspaceFile-DOZkPwzu.js";
3
+ import { r as WorkspaceSource } from "../Workspace-D39LxGvP.js";
2
4
  import { ThinkChatMessagesProps } from "./ThinkChat.js";
5
+ import { t as ThinkExecutionRun } from "../ThinkExecutionRun-ChhWhOoU.js";
6
+ import { ThinkFullAppView } from "./ThinkFullAppViewSwitch.js";
7
+ import { ThinkThreadStatusSummary } from "./ThinkThreadPicker.js";
8
+ import { ThinkThreadShell } from "./ThinkThreadShell.js";
3
9
  import * as React from "react";
4
10
  import { useAgentChat } from "@cloudflare/think/react";
5
11
  import { UIMessage } from "ai";
@@ -11,19 +17,27 @@ import { Think } from "@cloudflare/think";
11
17
  type ThinkAgent<State = unknown> = Think<object, State>;
12
18
  //#endregion
13
19
  //#region src/components/ThinkFullApp.d.ts
20
+ type ThinkFullAppMobileView = "chat" | "workbench";
14
21
  type ThinkFullAppAgent<State = unknown> = ThinkAgent<State>;
15
22
  type ThinkFullAppWorkbenchView = "files" | "execution" | (string & {});
23
+ interface ThinkFullAppWorkspaceConfig {
24
+ source: WorkspaceSource;
25
+ root?: string;
26
+ navigation: WorkspaceNavigationAdapter;
27
+ resolveFileAsset?: WorkspaceFileAssetResolver;
28
+ maxInlineAssetBytes?: number;
29
+ /** Leading workspace control, such as a host-owned Back to chat button. */
30
+ leading?: React.ReactNode;
31
+ actions?: React.ReactNode;
32
+ }
16
33
  interface ThinkFullAppPanelContext<AgentT extends ThinkFullAppAgent<State>, State = unknown, MessageT extends UIMessage = UIMessage> {
17
34
  agent: ReturnType<typeof useAgent<AgentT, State>>;
18
35
  chat: ReturnType<typeof useAgentChat<State, MessageT>>;
19
- workspace?: WorkspaceSource;
20
- workspaceRoot?: string;
36
+ workspace?: ThinkFullAppWorkspaceConfig;
21
37
  }
22
- interface ThinkFullAppPanel<AgentT extends ThinkFullAppAgent<State>, State = unknown, MessageT extends UIMessage = UIMessage> {
38
+ interface ThinkFullAppPanel<AgentT extends ThinkFullAppAgent<State>, State = unknown, MessageT extends UIMessage = UIMessage> extends ThinkFullAppView {
23
39
  /** Unique panel id used by `workbenchView`; custom panels should not reuse built-in ids. */
24
40
  id: ThinkFullAppWorkbenchView;
25
- label: string;
26
- icon: React.ReactNode;
27
41
  render: (context: ThinkFullAppPanelContext<AgentT, State, MessageT>) => React.ReactNode;
28
42
  }
29
43
  interface ThinkFullAppProps<AgentT extends ThinkFullAppAgent<State>, State = unknown, MessageT extends UIMessage = UIMessage> extends React.HTMLAttributes<HTMLDivElement> {
@@ -31,22 +45,43 @@ interface ThinkFullAppProps<AgentT extends ThinkFullAppAgent<State>, State = unk
31
45
  agent: ReturnType<typeof useAgent<AgentT, State>>;
32
46
  /** The `useAgentChat` value from `@cloudflare/think/react` used by the chat surface. */
33
47
  chat: ReturnType<typeof useAgentChat<State, MessageT>>;
34
- /** Optional workspace source shown in the file explorer pane. */
35
- workspace?: WorkspaceSource;
36
- /** Root path passed to the workspace explorer. */
37
- workspaceRoot?: string;
48
+ /** Atomic workspace source, navigation, media, and header configuration. */
49
+ workspace?: ThinkFullAppWorkspaceConfig;
50
+ /** Product-specific actions rendered in the application top bar. */
51
+ appBarActions?: React.ReactNode;
52
+ /** Product-specific navigation rendered after the built-in sidebar control. */
53
+ appBarLeading?: React.ReactNode;
54
+ /** Active conversation or page title rendered in the application top bar. */
55
+ appBarTitle?: React.ReactNode;
56
+ /** Aggregate thread activity rendered beside the compact thread-title disclosure. */
57
+ threadStatusSummary?: ThinkThreadStatusSummary;
58
+ /** Whether to include the built-in Execution workbench. Defaults to true. */
59
+ showExecutionWorkbench?: boolean;
60
+ /** Whole native execution selected by a parent-owned record. */
61
+ selectedExecutionRun?: ThinkExecutionRun | null;
62
+ /** Receives the whole native execution selected in the workbench. */
63
+ onSelectedExecutionRunChange?: (run: ThinkExecutionRun) => void;
38
64
  /** Message rendering labels and approval overrides for ThinkChat. */
39
65
  messages?: ThinkChatMessagesProps<MessageT>;
40
66
  /** Extra workbench panels appended after the built-in Files and Execution panels. */
41
67
  workbenchPanels?: readonly ThinkFullAppPanel<AgentT, State, MessageT>[];
42
- /** Optional parent-owned thread picker/sidebar rendered beside the selected child app. */
43
- threadSidebar?: React.ReactNode;
68
+ /**
69
+ * Optional parent-owned thread picker/sidebar rendered beside the selected child app.
70
+ * Use the render form to close the compact drawer after selecting a thread.
71
+ */
72
+ threadSidebar?: React.ComponentProps<typeof ThinkThreadShell>["sidebar"];
44
73
  /** Whether the thread sidebar is open. Omit for internal state. */
45
74
  threadSidebarOpen?: boolean;
46
75
  /** Initial thread sidebar state when `threadSidebarOpen` is uncontrolled. */
47
76
  defaultThreadSidebarOpen?: boolean;
48
77
  /** Called when the thread sidebar is opened or closed. */
49
78
  onThreadSidebarOpenChange?: (open: boolean) => void;
79
+ /** Visible surface at narrow widths. Omit for internal state. */
80
+ mobileView?: ThinkFullAppMobileView;
81
+ /** Initial narrow-width surface when `mobileView` is uncontrolled. */
82
+ defaultMobileView?: ThinkFullAppMobileView;
83
+ /** Called when narrow layouts switch between chat and the workbench. */
84
+ onMobileViewChange?: (view: ThinkFullAppMobileView) => void;
50
85
  /** Selected workbench lane. Use this when the parent app stores the lane in route state. */
51
86
  workbenchView?: ThinkFullAppWorkbenchView;
52
87
  /** Initial workbench lane when `workbenchView` is uncontrolled. */
@@ -57,24 +92,33 @@ interface ThinkFullAppProps<AgentT extends ThinkFullAppAgent<State>, State = unk
57
92
  /** Combines ThinkChat with an optional resizable workbench shell. */
58
93
  declare function ThinkFullApp<AgentT extends ThinkFullAppAgent<State>, State = unknown, MessageT extends UIMessage = UIMessage>({
59
94
  agent,
95
+ appBarActions,
96
+ appBarLeading,
97
+ appBarTitle,
60
98
  chat,
61
99
  className,
100
+ defaultMobileView,
62
101
  defaultWorkbenchView,
63
102
  defaultThreadSidebarOpen,
64
103
  messages,
104
+ mobileView,
105
+ onMobileViewChange,
106
+ onSelectedExecutionRunChange,
65
107
  onThreadSidebarOpenChange,
66
108
  onWorkbenchViewChange,
67
109
  ref,
110
+ selectedExecutionRun,
111
+ showExecutionWorkbench,
68
112
  style,
69
113
  threadSidebar,
70
114
  threadSidebarOpen,
115
+ threadStatusSummary,
71
116
  workbenchPanels,
72
117
  workbenchView,
73
118
  workspace,
74
- workspaceRoot,
75
119
  ...props
76
120
  }: ThinkFullAppProps<AgentT, State, MessageT> & {
77
121
  ref?: React.Ref<HTMLDivElement>;
78
122
  }): React.JSX.Element;
79
123
  //#endregion
80
- export { ThinkFullApp, ThinkFullAppAgent, ThinkFullAppPanel, ThinkFullAppPanelContext, ThinkFullAppProps, ThinkFullAppWorkbenchView };
124
+ export { ThinkFullApp, ThinkFullAppAgent, ThinkFullAppMobileView, ThinkFullAppPanel, ThinkFullAppPanelContext, ThinkFullAppProps, ThinkFullAppWorkbenchView, ThinkFullAppWorkspaceConfig };