@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,93 +1,41 @@
1
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { I as TerminalIcon, h as FileIcon, n as ArrowLeftIcon } from "../icons-Ba9THQKz.js";
3
- import { Separator } from "./Separator.js";
2
+ import { G as TerminalIcon, s as ChevronDownIcon, v as FileIcon } from "../icons-CpfUer49.js";
4
3
  import { Button } from "./Button.js";
5
- import { Tooltip } from "./Tooltip.js";
6
- import { ToggleGroup } from "./ToggleGroup.js";
7
- import { o as useThinkPendingApprovals, s as resolveThinkApprovalProps, t as ThinkChat } from "../ThinkChat-7DQ2CogF.js";
8
- import { WorkspaceExplorer, useWorkspace } from "./WorkspaceExplorer.js";
4
+ import { a as WorkspaceNavigationRestorationBoundary, i as WorkspaceNavigationFocusRestorer, n as WorkspaceNavigationProvider } from "../WorkspaceLink-DIPbXrUM.js";
5
+ import { n as mergeRefs } from "../merge-refs-DF_7w2x_.js";
6
+ import { AppTopBar } from "./AppTopBar.js";
7
+ import { ResizableSidePanel } from "./ResizableSidePanel.js";
8
+ import { o as useThinkPendingApprovals, s as resolveThinkApprovalProps, t as ThinkChat } from "../ThinkChat-CzC-zNGA.js";
9
+ import { useWorkspace } from "./Workspace.js";
10
+ import { WorkspaceExplorer } from "./WorkspaceExplorer.js";
9
11
  import { ThinkExecutionWorkbench } from "./ThinkExecutionWorkbench.js";
12
+ import { ThinkFullAppViewSwitch } from "./ThinkFullAppViewSwitch.js";
13
+ import { ThinkThreadStatusIndicators } from "./ThinkThreadPicker.js";
10
14
  import { ThinkThreadShell } from "./ThinkThreadShell.js";
11
15
  import * as React from "react";
12
- import { jsx, jsxs } from "react/jsx-runtime";
16
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
17
  //#region src/components/ThinkFullApp.tsx
14
18
  const workbenchPanelDefaultWidth = 340;
15
19
  const workbenchPanelMinWidth = 300;
16
20
  const workbenchPanelMaxWidth = 600;
17
21
  const workbenchPanelKeyboardStep = 24;
18
- function clampWorkbenchPanelWidth(width) {
19
- return Math.min(workbenchPanelMaxWidth, Math.max(workbenchPanelMinWidth, width));
20
- }
21
- function beginWorkbenchPanelResize(event, current, apply) {
22
- event.preventDefault();
23
- const startX = event.clientX;
24
- const onMove = (move) => {
25
- apply(clampWorkbenchPanelWidth(current - (move.clientX - startX)));
26
- };
27
- const onUp = () => {
28
- window.removeEventListener("pointermove", onMove);
29
- window.removeEventListener("pointerup", onUp);
30
- window.removeEventListener("pointercancel", onUp);
31
- document.body.classList.remove("is-resizing-think-full-app");
32
- };
33
- document.body.classList.add("is-resizing-think-full-app");
34
- window.addEventListener("pointermove", onMove);
35
- window.addEventListener("pointerup", onUp);
36
- window.addEventListener("pointercancel", onUp);
37
- }
38
- function WorkbenchBackButton({ onBack }) {
39
- return /* @__PURE__ */ jsx(Button, {
40
- type: "button",
41
- variant: "ghost",
42
- color: "neutral",
43
- size: "icon-sm",
44
- className: "think-full-app__workspace-back",
45
- "aria-label": "Show chat",
46
- onClick: onBack,
47
- children: /* @__PURE__ */ jsx(ArrowLeftIcon, {})
48
- });
49
- }
50
- function WorkspacePanel({ source, root }) {
22
+ function WorkspacePanel({ config }) {
51
23
  return /* @__PURE__ */ jsx(WorkspaceExplorer, {
52
24
  className: "think-full-app__workbench",
53
25
  workspace: useWorkspace({
54
- source,
55
- root
56
- })
57
- });
58
- }
59
- function WorkbenchViewItem({ children, label, value }) {
60
- return /* @__PURE__ */ jsxs(Tooltip.Root, { children: [/* @__PURE__ */ jsx(Tooltip.Trigger, { render: /* @__PURE__ */ jsx(ToggleGroup.Item, {
61
- type: "button",
62
- className: "think-full-app__workbench-view-item",
63
- value,
64
- "aria-label": label,
65
- children
66
- }) }), /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
67
- side: "bottom",
68
- sideOffset: 6,
69
- children: /* @__PURE__ */ jsx(Tooltip.Popup, { children: label })
70
- }) })] });
71
- }
72
- function WorkbenchViewSwitch({ panels, value, onValueChange }) {
73
- return /* @__PURE__ */ jsx(ToggleGroup.Root, {
74
- className: "think-full-app__workbench-view-switch",
75
- size: "sm",
76
- value: [value],
77
- "aria-label": "Workbench views",
78
- onValueChange: (nextValue) => {
79
- const [next] = nextValue;
80
- if (next) onValueChange(next);
81
- },
82
- children: panels.map((panel) => /* @__PURE__ */ jsx(WorkbenchViewItem, {
83
- value: panel.id,
84
- label: panel.label,
85
- children: panel.icon
86
- }, panel.id))
26
+ source: config.source,
27
+ root: config.root,
28
+ resolveFileAsset: config.resolveFileAsset,
29
+ maxInlineAssetBytes: config.maxInlineAssetBytes
30
+ }),
31
+ navigation: config.navigation,
32
+ leading: config.leading,
33
+ actions: config.actions
87
34
  });
88
35
  }
89
36
  /** Combines ThinkChat with an optional resizable workbench shell. */
90
- function ThinkFullApp({ agent, chat, className, defaultWorkbenchView, defaultThreadSidebarOpen, messages, onThreadSidebarOpenChange, onWorkbenchViewChange, ref, style, threadSidebar, threadSidebarOpen, workbenchPanels, workbenchView, workspace, workspaceRoot, ...props }) {
37
+ function ThinkFullApp({ agent, appBarActions, appBarLeading, appBarTitle, chat, className, defaultMobileView, defaultWorkbenchView, defaultThreadSidebarOpen, messages, mobileView, onMobileViewChange, onSelectedExecutionRunChange, onThreadSidebarOpenChange, onWorkbenchViewChange, ref, selectedExecutionRun, showExecutionWorkbench = true, style, threadSidebar, threadSidebarOpen, threadStatusSummary, workbenchPanels, workbenchView, workspace, ...props }) {
38
+ const appRef = React.useRef(null);
91
39
  const approvals = useThinkPendingApprovals(agent.stub, `${chat.messages.length}:${chat.status}`);
92
40
  const resolvedMessages = React.useMemo(() => {
93
41
  const approvalProps = resolveThinkApprovalProps({
@@ -109,20 +57,16 @@ function ThinkFullApp({ agent, chat, className, defaultWorkbenchView, defaultThr
109
57
  approvals.refreshPendingApprovals,
110
58
  messages
111
59
  ]);
112
- const [mobileView, setMobileView] = React.useState("chat");
60
+ const [innerMobileView, setInnerMobileView] = React.useState(defaultMobileView ?? "chat");
113
61
  const [innerWorkbenchView, setInnerWorkbenchView] = React.useState(defaultWorkbenchView ?? "files");
114
- const [workbenchPanelWidth, setWorkbenchPanelWidth] = React.useState(workbenchPanelDefaultWidth);
115
- const hasWorkspace = workspace !== void 0;
116
62
  const panelContext = React.useMemo(() => ({
117
63
  agent,
118
64
  chat,
119
- workspace,
120
- workspaceRoot
65
+ workspace
121
66
  }), [
122
67
  agent,
123
68
  chat,
124
- workspace,
125
- workspaceRoot
69
+ workspace
126
70
  ]);
127
71
  const availableWorkbenchPanels = React.useMemo(() => {
128
72
  const builtInPanels = [];
@@ -130,82 +74,119 @@ function ThinkFullApp({ agent, chat, className, defaultWorkbenchView, defaultThr
130
74
  id: "files",
131
75
  label: "Files",
132
76
  icon: /* @__PURE__ */ jsx(FileIcon, {}),
133
- render: () => /* @__PURE__ */ jsx(WorkspacePanel, {
134
- source: workspace,
135
- root: workspaceRoot
136
- })
77
+ render: () => /* @__PURE__ */ jsx(WorkspacePanel, { config: workspace })
137
78
  });
138
- builtInPanels.push({
79
+ if (showExecutionWorkbench) builtInPanels.push({
139
80
  id: "execution",
140
81
  label: "Execution",
141
82
  icon: /* @__PURE__ */ jsx(TerminalIcon, {}),
142
83
  render: ({ agent }) => /* @__PURE__ */ jsx(ThinkExecutionWorkbench, {
143
84
  source: agent.stub,
144
- title: "Execution"
85
+ title: "Execution",
86
+ selectedRun: selectedExecutionRun,
87
+ onSelectedRunChange: onSelectedExecutionRunChange
145
88
  })
146
89
  });
147
90
  return workbenchPanels ? [...builtInPanels, ...workbenchPanels] : builtInPanels;
148
91
  }, [
92
+ onSelectedExecutionRunChange,
93
+ selectedExecutionRun,
94
+ showExecutionWorkbench,
149
95
  workbenchPanels,
150
- workspace,
151
- workspaceRoot
96
+ workspace
152
97
  ]);
153
- const activeMobileView = mobileView === "workbench" ? "workbench" : "chat";
154
- const isMobileWorkbenchView = activeMobileView === "workbench";
98
+ const requestedMobileView = mobileView ?? innerMobileView;
155
99
  const requestedWorkbenchView = workbenchView ?? innerWorkbenchView;
156
100
  const activePanel = availableWorkbenchPanels.find((panel) => panel.id === requestedWorkbenchView) ?? availableWorkbenchPanels[0];
157
- const activeWorkbenchView = activePanel?.id ?? "execution";
158
- const mobileWorkbenchLabel = hasWorkspace && activeWorkbenchView === "files" ? "Show workbench" : `Show ${activePanel?.label.toLowerCase() ?? "workbench"}`;
101
+ const activeWorkbenchView = activePanel?.id;
102
+ const hasWorkbench = activePanel !== void 0;
103
+ const activeMobileView = hasWorkbench ? requestedMobileView : "chat";
159
104
  const showWorkbenchViewSwitch = availableWorkbenchPanels.length > 1;
160
- const showShellTopbar = showWorkbenchViewSwitch || isMobileWorkbenchView;
161
- const rootStyle = {
162
- ...style,
163
- "--think-full-app-workbench-w": `${workbenchPanelWidth}px`
164
- };
165
- const resizeWorkbenchPanelBy = (delta) => {
166
- setWorkbenchPanelWidth((current) => clampWorkbenchPanelWidth(current + delta));
167
- };
105
+ const workbenchViews = availableWorkbenchPanels;
168
106
  const setWorkbenchView = React.useCallback((next) => {
169
107
  if (workbenchView === void 0) setInnerWorkbenchView(next);
170
108
  onWorkbenchViewChange?.(next);
171
109
  }, [onWorkbenchViewChange, workbenchView]);
172
- const app = /* @__PURE__ */ jsxs("div", {
173
- ref,
110
+ const setMobileView = React.useCallback((next) => {
111
+ if (mobileView === void 0) setInnerMobileView(next);
112
+ onMobileViewChange?.(next);
113
+ }, [mobileView, onMobileViewChange]);
114
+ const renderAppTopBar = (sidebarControls) => /* @__PURE__ */ jsxs(AppTopBar.Root, {
115
+ className: "think-full-app__app-bar",
116
+ "aria-label": "Workbench controls",
117
+ "data-mobile-view": activeMobileView,
118
+ children: [
119
+ /* @__PURE__ */ jsxs(AppTopBar.Leading, { children: [sidebarControls?.sidebarToggle, appBarLeading] }),
120
+ appBarTitle || sidebarControls ? /* @__PURE__ */ jsxs(AppTopBar.Title, { children: [appBarTitle ? /* @__PURE__ */ jsx("span", {
121
+ className: "think-full-app__app-title",
122
+ children: appBarTitle
123
+ }) : null, sidebarControls ? /* @__PURE__ */ jsxs(Button, {
124
+ type: "button",
125
+ variant: "ghost",
126
+ color: "neutral",
127
+ size: "sm",
128
+ className: "think-full-app__thread-trigger",
129
+ "aria-controls": sidebarControls.sidebarId,
130
+ "aria-expanded": sidebarControls.sidebarOpen,
131
+ onClick: (event) => sidebarControls.toggleSidebar(event.currentTarget),
132
+ children: [
133
+ /* @__PURE__ */ jsx("span", {
134
+ className: "think-full-app__thread-trigger-title",
135
+ children: appBarTitle ?? "Threads"
136
+ }),
137
+ threadStatusSummary ? /* @__PURE__ */ jsx(ThinkThreadStatusIndicators, { summary: threadStatusSummary }) : null,
138
+ /* @__PURE__ */ jsx(ChevronDownIcon, { "aria-hidden": "true" })
139
+ ]
140
+ }) : null] }) : null,
141
+ /* @__PURE__ */ jsxs(AppTopBar.Trailing, { children: [
142
+ appBarActions,
143
+ showWorkbenchViewSwitch && activeWorkbenchView ? /* @__PURE__ */ jsx(ThinkFullAppViewSwitch, {
144
+ className: "think-full-app__workbench-view-switch",
145
+ views: workbenchViews,
146
+ value: activeWorkbenchView,
147
+ onValueChange: (next) => {
148
+ if (next) setWorkbenchView(next);
149
+ },
150
+ "aria-label": "Workbench views"
151
+ }) : null,
152
+ activePanel ? /* @__PURE__ */ jsx(ThinkFullAppViewSwitch, {
153
+ className: "think-full-app__mobile-view-switch",
154
+ views: workbenchViews,
155
+ value: activeMobileView === "workbench" ? activePanel.id : void 0,
156
+ allowEmpty: true,
157
+ onValueChange: (next) => {
158
+ if (!next) {
159
+ setMobileView("chat");
160
+ return;
161
+ }
162
+ setWorkbenchView(next);
163
+ setMobileView("workbench");
164
+ },
165
+ "aria-label": "App views"
166
+ }) : null
167
+ ] })
168
+ ]
169
+ });
170
+ const appContent = /* @__PURE__ */ jsxs(ResizableSidePanel.Root, {
171
+ ref: mergeRefs(appRef, ref),
174
172
  className: cx("think-full-app", className),
173
+ label: "workbench",
174
+ side: "end",
175
+ defaultSize: workbenchPanelDefaultWidth,
176
+ minSize: workbenchPanelMinWidth,
177
+ maxSize: workbenchPanelMaxWidth,
178
+ keyboardStep: workbenchPanelKeyboardStep,
175
179
  "data-has-thread-sidebar": threadSidebar ? "true" : "false",
176
- "data-has-workbench-topbar": showWorkbenchViewSwitch ? "true" : "false",
180
+ "data-has-workbench": hasWorkbench ? "true" : "false",
181
+ "data-has-workbench-topbar": threadSidebar ? "false" : "true",
177
182
  "data-mobile-view": activeMobileView,
178
- style: rootStyle,
183
+ style,
179
184
  ...props,
180
185
  children: [
181
- showShellTopbar ? /* @__PURE__ */ jsxs("div", {
182
- className: "think-full-app__topbar",
183
- role: "toolbar",
184
- "aria-label": "Workbench controls",
185
- "data-mobile-only": showWorkbenchViewSwitch ? void 0 : "true",
186
- children: [/* @__PURE__ */ jsx(WorkbenchBackButton, { onBack: () => setMobileView("chat") }), showWorkbenchViewSwitch ? /* @__PURE__ */ jsx(WorkbenchViewSwitch, {
187
- panels: availableWorkbenchPanels,
188
- value: activeWorkbenchView,
189
- onValueChange: setWorkbenchView
190
- }) : null]
191
- }) : null,
192
- !isMobileWorkbenchView ? /* @__PURE__ */ jsx("div", {
193
- className: "think-full-app__mobile-header",
194
- role: "toolbar",
195
- "aria-label": "Workbench",
196
- children: /* @__PURE__ */ jsx(Button, {
197
- type: "button",
198
- variant: "ghost",
199
- color: "neutral",
200
- size: "icon-sm",
201
- className: "think-full-app__mobile-action",
202
- "aria-label": mobileWorkbenchLabel,
203
- onClick: () => setMobileView("workbench"),
204
- children: activePanel?.icon ?? /* @__PURE__ */ jsx(TerminalIcon, {})
205
- })
206
- }) : null,
186
+ !threadSidebar ? renderAppTopBar() : null,
207
187
  /* @__PURE__ */ jsx("section", {
208
188
  className: "think-full-app__chat-surface",
189
+ "data-workspace-restoration-scope": "chat",
209
190
  "aria-label": "Chat",
210
191
  children: /* @__PURE__ */ jsx("div", {
211
192
  className: "think-full-app__chat",
@@ -230,33 +211,7 @@ function ThinkFullApp({ agent, chat, className, defaultWorkbenchView, defaultThr
230
211
  })
231
212
  })
232
213
  }),
233
- /* @__PURE__ */ jsx(Separator, {
234
- decorative: false,
235
- orientation: "vertical",
236
- tabIndex: 0,
237
- "aria-label": "Resize workbench panel",
238
- "aria-valuemin": workbenchPanelMinWidth,
239
- "aria-valuemax": workbenchPanelMaxWidth,
240
- "aria-valuenow": workbenchPanelWidth,
241
- className: "think-resize-handle think-full-app__resizer",
242
- onPointerDown: (event) => beginWorkbenchPanelResize(event, workbenchPanelWidth, setWorkbenchPanelWidth),
243
- onKeyDown: (event) => {
244
- if (event.key === "ArrowLeft") {
245
- event.preventDefault();
246
- resizeWorkbenchPanelBy(workbenchPanelKeyboardStep);
247
- } else if (event.key === "ArrowRight") {
248
- event.preventDefault();
249
- resizeWorkbenchPanelBy(-24);
250
- } else if (event.key === "Home") {
251
- event.preventDefault();
252
- setWorkbenchPanelWidth(workbenchPanelMinWidth);
253
- } else if (event.key === "End") {
254
- event.preventDefault();
255
- setWorkbenchPanelWidth(workbenchPanelMaxWidth);
256
- }
257
- }
258
- }),
259
- /* @__PURE__ */ jsx("aside", {
214
+ activePanel ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ResizableSidePanel.Handle, { className: "think-full-app__resizer" }), /* @__PURE__ */ jsx("aside", {
260
215
  className: "think-full-app__aside",
261
216
  "aria-label": "Workbench",
262
217
  children: /* @__PURE__ */ jsx("div", {
@@ -264,18 +219,32 @@ function ThinkFullApp({ agent, chat, className, defaultWorkbenchView, defaultThr
264
219
  children: /* @__PURE__ */ jsx("div", {
265
220
  className: "think-full-app__workbench-panel",
266
221
  "data-view": activeWorkbenchView,
267
- children: activePanel?.render(panelContext)
222
+ children: activePanel.render(panelContext)
268
223
  })
269
224
  })
270
- })
225
+ })] }) : null
271
226
  ]
272
227
  });
228
+ const app = workspace ? /* @__PURE__ */ jsx(WorkspaceNavigationProvider, {
229
+ root: workspace.root ?? "/",
230
+ base: {
231
+ kind: "directory",
232
+ path: workspace.root ?? "/"
233
+ },
234
+ navigation: workspace.navigation,
235
+ children: /* @__PURE__ */ jsxs(WorkspaceNavigationRestorationBoundary, { children: [/* @__PURE__ */ jsx(WorkspaceNavigationFocusRestorer, {
236
+ entryKey: workspace.navigation.current.key,
237
+ rootRef: appRef,
238
+ scope: "chat"
239
+ }), appContent] })
240
+ }) : appContent;
273
241
  if (!threadSidebar) return app;
274
242
  return /* @__PURE__ */ jsx(ThinkThreadShell, {
275
243
  sidebar: threadSidebar,
276
244
  sidebarOpen: threadSidebarOpen,
277
245
  defaultSidebarOpen: defaultThreadSidebarOpen,
278
246
  onSidebarOpenChange: onThreadSidebarOpenChange,
247
+ topBar: (controls) => renderAppTopBar(controls),
279
248
  children: app
280
249
  });
281
250
  }
@@ -0,0 +1,31 @@
1
+ import { r as ToggleGroupProps } from "../ToggleGroup-8hPv-b69.js";
2
+ import * as React from "react";
3
+
4
+ //#region src/components/ThinkFullAppViewSwitch.d.ts
5
+ interface ThinkFullAppView {
6
+ id: string;
7
+ label: string;
8
+ icon: React.ReactNode;
9
+ }
10
+ interface ThinkFullAppViewSwitchProps extends Omit<ToggleGroupProps, "children" | "onValueChange" | "value"> {
11
+ views: readonly ThinkFullAppView[];
12
+ value?: string;
13
+ /** Whether pressing the selected view may clear the selection. */
14
+ allowEmpty?: boolean;
15
+ onValueChange: (value: string | undefined, eventDetails: Parameters<NonNullable<ToggleGroupProps["onValueChange"]>>[1]) => void;
16
+ }
17
+ /**
18
+ * Icon view picker shared by ThinkFullApp's wide workbench and compact app
19
+ * navigation. Base UI owns selection and roving focus; AppTopBar owns the
20
+ * toolbar control and tooltip presentation.
21
+ */
22
+ declare function ThinkFullAppViewSwitch({
23
+ allowEmpty,
24
+ className,
25
+ onValueChange,
26
+ value,
27
+ views,
28
+ ...props
29
+ }: ThinkFullAppViewSwitchProps): React.JSX.Element;
30
+ //#endregion
31
+ export { ThinkFullAppView, ThinkFullAppViewSwitch, ThinkFullAppViewSwitchProps };
@@ -0,0 +1,34 @@
1
+ import { t as cx } from "../class-names-9UtZwb0J.js";
2
+ import { AppTopBar } from "./AppTopBar.js";
3
+ import { ToggleGroup } from "./ToggleGroup.js";
4
+ import "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ //#region src/components/ThinkFullAppViewSwitch.tsx
7
+ /**
8
+ * Icon view picker shared by ThinkFullApp's wide workbench and compact app
9
+ * navigation. Base UI owns selection and roving focus; AppTopBar owns the
10
+ * toolbar control and tooltip presentation.
11
+ */
12
+ function ThinkFullAppViewSwitch({ allowEmpty = false, className, onValueChange, value, views, ...props }) {
13
+ return /* @__PURE__ */ jsx(ToggleGroup.Root, {
14
+ className: cx("think-full-app__view-switch", className),
15
+ size: "sm",
16
+ value: value ? [value] : [],
17
+ onValueChange: (nextValue, eventDetails) => {
18
+ const [next] = nextValue;
19
+ if (next || allowEmpty) onValueChange(next, eventDetails);
20
+ },
21
+ ...props,
22
+ children: views.map((view) => /* @__PURE__ */ jsx(AppTopBar.Button, {
23
+ type: "button",
24
+ label: view.label,
25
+ render: /* @__PURE__ */ jsx(ToggleGroup.Item, {
26
+ type: "button",
27
+ value: view.id
28
+ }),
29
+ children: view.icon
30
+ }, view.id))
31
+ });
32
+ }
33
+ //#endregion
34
+ export { ThinkFullAppViewSwitch };
@@ -0,0 +1,36 @@
1
+ import { t as ThinkExecutionRun } from "../ThinkExecutionRun-ChhWhOoU.js";
2
+ import { ThinkScheduledTask } from "@cloudflare/think";
3
+ import { Schedule } from "agents";
4
+
5
+ //#region src/components/ThinkRoutine.d.ts
6
+ /** App-owned identity for the Think agent that owns a routine. */
7
+ interface ThinkRoutineOwner {
8
+ id: string;
9
+ name: string;
10
+ }
11
+ /**
12
+ * App-level routine descriptor. Scheduling and execution records remain whole
13
+ * upstream Think/Agents SDK values; only library identity and enabled state are
14
+ * app-owned because neither SDK provides a cross-agent routine catalog.
15
+ */
16
+ interface ThinkRoutine {
17
+ id: string;
18
+ name: string;
19
+ description?: string;
20
+ enabled: boolean;
21
+ owner: ThinkRoutineOwner;
22
+ task: ThinkScheduledTask;
23
+ schedule?: Schedule<unknown> | null;
24
+ runs: readonly ThinkExecutionRun[];
25
+ }
26
+ /** Preserves an app-enriched native execution type carried by a routine subtype. */
27
+ type ThinkRoutineRunOf<TRoutine extends ThinkRoutine = ThinkRoutine> = TRoutine["runs"][number];
28
+ interface ThinkRoutineCreateRequest {
29
+ name: string;
30
+ ownerId: string;
31
+ /** Whole upstream task, including prompt functions and handler tasks. */
32
+ task: ThinkScheduledTask;
33
+ }
34
+ declare function getThinkRoutineNextRun(routine: ThinkRoutine): string;
35
+ //#endregion
36
+ export { ThinkRoutine, ThinkRoutineCreateRequest, ThinkRoutineOwner, ThinkRoutineRunOf, getThinkRoutineNextRun };
@@ -0,0 +1,15 @@
1
+ //#region src/components/ThinkRoutine.ts
2
+ function getThinkRoutineNextRun(routine) {
3
+ return routine.schedule ? formatThinkExecutionDate(routine.schedule.time * 1e3, "Not scheduled") : "Pending reconciliation";
4
+ }
5
+ function formatThinkExecutionDate(value, fallback) {
6
+ const date = value instanceof Date ? value : new Date(value);
7
+ return Number.isNaN(date.getTime()) ? fallback : date.toLocaleString(void 0, {
8
+ month: "short",
9
+ day: "numeric",
10
+ hour: "numeric",
11
+ minute: "2-digit"
12
+ });
13
+ }
14
+ //#endregion
15
+ export { getThinkRoutineNextRun };
@@ -0,0 +1,25 @@
1
+ import { ThinkRoutine } from "./ThinkRoutine.js";
2
+ import * as React from "react";
3
+
4
+ //#region src/components/ThinkRoutineBrowser.d.ts
5
+ type ThinkRoutineFilter = "all" | "active" | "paused";
6
+ interface ThinkRoutineBrowserProps extends Omit<React.HTMLAttributes<HTMLElement>, "onSelect"> {
7
+ routines: readonly ThinkRoutine[];
8
+ selectedRoutineId?: string;
9
+ onSelectedRoutineIdChange?: (routineId: string) => void;
10
+ onCreateRoutine?: () => void;
11
+ }
12
+ /** Searchable, filterable navigation for an app-owned collection of Think routines. */
13
+ declare function ThinkRoutineBrowser({
14
+ className,
15
+ routines,
16
+ selectedRoutineId,
17
+ onSelectedRoutineIdChange,
18
+ onCreateRoutine,
19
+ ref,
20
+ ...props
21
+ }: ThinkRoutineBrowserProps & {
22
+ ref?: React.Ref<HTMLElement>;
23
+ }): React.JSX.Element;
24
+ //#endregion
25
+ export { ThinkRoutineBrowser, ThinkRoutineBrowserProps, ThinkRoutineFilter };