@mcp-b/react-components 0.16.1 → 0.17.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 (284) hide show
  1. package/dist/{AgentChat-CrlpbvQJ.d.ts → AgentChat-CRuMi1Pb.d.ts} +4 -10
  2. package/dist/AgentMessageParts-CyD2UB3V.d.ts +46 -0
  3. package/dist/AgentToolRunsContext-BVe4stgw.d.ts +21 -0
  4. package/dist/{CodeBlock-BmB4Xaqq.js → CodeBlock-Co1noLbC.js} +2 -2
  5. package/dist/{CodeBlock-BRajW4QU.d.ts → CodeBlock-Dnpr88ZQ.d.ts} +2 -2
  6. package/dist/Collapsible-N64ASIQr.d.ts +119 -0
  7. package/dist/{Combobox-B9Fcd6q-.d.ts → Combobox-CYc37s5l.d.ts} +11 -33
  8. package/dist/{FileTree-CkVbIMWV.js → FileTree-B7bBsUyU.js} +7 -7
  9. package/dist/{Menu-Bgu-ufb5.d.ts → Menu-L6MZm-7N.d.ts} +15 -56
  10. package/dist/{Message-BkMdE3bS.js → Message-C4eYRogZ.js} +3 -3
  11. package/dist/{ModelSelector-SlJNgwKY.js → ModelSelector-BNrZlY_Y.js} +5 -5
  12. package/dist/{PromptInput-BWTuXMOD.d.ts → PromptInput-OLfXPuHM.d.ts} +39 -67
  13. package/dist/{ResponsiveSidebarShell-Dd9DCcBT.d.ts → ResponsiveSidebarShell-CsAh4NyL.d.ts} +1 -0
  14. package/dist/{Select-BeEsefzh.d.ts → Select-CwSqP07Y.d.ts} +14 -42
  15. package/dist/{Tabs-3Zc4tb9D.d.ts → Tabs-9zddXDQo.d.ts} +5 -19
  16. package/dist/{ThinkChat-CzC-zNGA.js → ThinkChat-DInElus-.js} +53 -26
  17. package/dist/{ThinkChatActivity-BFQnb2ct.d.ts → ThinkChatActivity-BgesTfZ4.d.ts} +12 -4
  18. package/dist/{ThinkChatContext-C3Eb1Xpi.d.ts → ThinkChatContext-DrsZqdaO.d.ts} +1 -1
  19. package/dist/ThinkRecoveryNotice-DFIcG9UX.d.ts +19 -0
  20. package/dist/{Toggle-CAAlNl-M.d.ts → Toggle-DaXpe1Lc.d.ts} +1 -1
  21. package/dist/{ToggleGroup-8hPv-b69.d.ts → ToggleGroup-yseEWkOC.d.ts} +3 -4
  22. package/dist/{Workspace-D39LxGvP.d.ts → Workspace-C9RFoxcu.d.ts} +1 -1
  23. package/dist/WorkspaceExplorer-sZewzT2O.d.ts +32 -0
  24. package/dist/{WorkspaceFile-DOZkPwzu.d.ts → WorkspaceFile-C8UzuSH4.d.ts} +1 -1
  25. package/dist/{WorkspaceFileView-rSN_yT0L.js → WorkspaceFileView-DNdGAEiX.js} +5 -5
  26. package/dist/{WorkspaceLink-DIPbXrUM.js → WorkspaceLink-B1ykV1dS.js} +15 -29
  27. package/dist/class-names-Bk-QLWWI.js +11 -0
  28. package/dist/components/Accordion.d.ts +5 -15
  29. package/dist/components/Accordion.js +11 -10
  30. package/dist/components/Activity.d.ts +5 -10
  31. package/dist/components/Activity.js +2 -2
  32. package/dist/components/AgentActivity.js +1 -1
  33. package/dist/components/AgentActivityPreview.js +2 -2
  34. package/dist/components/AgentAttention.d.ts +1 -1
  35. package/dist/components/AgentAttention.js +1 -1
  36. package/dist/components/AgentChat.d.ts +2 -2
  37. package/dist/components/AgentChat.js +27 -164
  38. package/dist/components/AgentChatMessageEditor.js +1 -1
  39. package/dist/components/AgentConnection.js +4 -4
  40. package/dist/components/AgentMessageParts.d.ts +2 -0
  41. package/dist/components/AgentMessageParts.js +119 -0
  42. package/dist/components/AgentToolDetail.d.ts +55 -0
  43. package/dist/components/AgentToolDetail.js +98 -0
  44. package/dist/components/AgentToolRunsContext.d.ts +2 -0
  45. package/dist/components/AgentToolRunsContext.js +16 -0
  46. package/dist/components/AlertDialog.d.ts +7 -19
  47. package/dist/components/AlertDialog.js +21 -32
  48. package/dist/components/AppTopBar.d.ts +4 -1
  49. package/dist/components/AppTopBar.js +5 -5
  50. package/dist/components/Approval.d.ts +102 -0
  51. package/dist/components/Approval.js +227 -0
  52. package/dist/components/Artifact.d.ts +2 -4
  53. package/dist/components/Artifact.js +3 -3
  54. package/dist/components/Autocomplete.d.ts +11 -33
  55. package/dist/components/Autocomplete.js +23 -30
  56. package/dist/components/Avatar.d.ts +3 -11
  57. package/dist/components/Avatar.js +13 -12
  58. package/dist/components/BrowserLiveView.js +2 -2
  59. package/dist/components/BrowserReplay.js +2 -2
  60. package/dist/components/BrowserRunPanel.js +58 -78
  61. package/dist/components/Button.js +4 -9
  62. package/dist/components/ChainOfThought.d.ts +5 -11
  63. package/dist/components/ChainOfThought.js +3 -2
  64. package/dist/components/ChatGptSignInScreen.js +3 -3
  65. package/dist/components/Checkbox.d.ts +2 -4
  66. package/dist/components/Checkbox.js +6 -5
  67. package/dist/components/CheckboxGroup.d.ts +1 -3
  68. package/dist/components/CheckboxGroup.js +15 -14
  69. package/dist/components/Checkpoint.d.ts +64 -0
  70. package/dist/components/Checkpoint.js +63 -0
  71. package/dist/components/CodeBlock.d.ts +1 -1
  72. package/dist/components/CodeBlock.js +1 -1
  73. package/dist/components/CodexModelSelector.d.ts +1 -1
  74. package/dist/components/CodexModelSelector.js +2 -2
  75. package/dist/components/Collapsible.d.ts +1 -124
  76. package/dist/components/Collapsible.js +7 -10
  77. package/dist/components/Combobox.d.ts +1 -1
  78. package/dist/components/Combobox.js +23 -30
  79. package/dist/components/Commit.d.ts +5 -11
  80. package/dist/components/Commit.js +6 -5
  81. package/dist/components/Context.js +1 -1
  82. package/dist/components/ContextMenu.d.ts +21 -37
  83. package/dist/components/ContextMenu.js +34 -51
  84. package/dist/components/Conversation.d.ts +2 -4
  85. package/dist/components/Conversation.js +2 -2
  86. package/dist/components/DescriptionListParts.js +1 -1
  87. package/dist/components/Dialog.d.ts +6 -17
  88. package/dist/components/Dialog.js +17 -24
  89. package/dist/components/EnvironmentVariables.d.ts +1 -1
  90. package/dist/components/EnvironmentVariables.js +4 -3
  91. package/dist/components/Field.d.ts +17 -20
  92. package/dist/components/Field.js +16 -16
  93. package/dist/components/Fieldset.d.ts +2 -7
  94. package/dist/components/Fieldset.js +7 -6
  95. package/dist/components/FileTree.js +1 -1
  96. package/dist/components/Form.d.ts +1 -4
  97. package/dist/components/Form.js +3 -2
  98. package/dist/components/GithubMotionMark.js +1 -1
  99. package/dist/components/InlineCitation.d.ts +66 -0
  100. package/dist/components/InlineCitation.js +142 -0
  101. package/dist/components/Input.d.ts +1 -4
  102. package/dist/components/Input.js +3 -2
  103. package/dist/components/Marker.js +1 -1
  104. package/dist/components/McpConnectionRequest.js +2 -2
  105. package/dist/components/McpServerPicker.d.ts +1 -1
  106. package/dist/components/McpServerPicker.js +6 -5
  107. package/dist/components/Menu.d.ts +1 -1
  108. package/dist/components/Menu.js +33 -52
  109. package/dist/components/Menubar.d.ts +22 -43
  110. package/dist/components/Menubar.js +36 -53
  111. package/dist/components/Message.d.ts +3 -6
  112. package/dist/components/Message.js +1 -1
  113. package/dist/components/MessageScroller.d.ts +1 -1
  114. package/dist/components/MessageScroller.js +3 -3
  115. package/dist/components/Meter.d.ts +5 -20
  116. package/dist/components/Meter.js +11 -10
  117. package/dist/components/ModelSelector.d.ts +2 -6
  118. package/dist/components/ModelSelector.js +1 -1
  119. package/dist/components/NavigationMenu.d.ts +11 -33
  120. package/dist/components/NavigationMenu.js +23 -30
  121. package/dist/components/NumberField.d.ts +6 -24
  122. package/dist/components/NumberField.js +13 -12
  123. package/dist/components/Plan.d.ts +103 -0
  124. package/dist/components/Plan.js +113 -0
  125. package/dist/components/Popover.d.ts +9 -36
  126. package/dist/components/Popover.js +23 -34
  127. package/dist/components/PreviewCard.d.ts +6 -24
  128. package/dist/components/PreviewCard.js +13 -24
  129. package/dist/components/PricingBillingToggle.js +1 -1
  130. package/dist/components/PricingFAQ.js +1 -1
  131. package/dist/components/PricingPlanCard.js +3 -3
  132. package/dist/components/PricingUsageCalculator.js +2 -2
  133. package/dist/components/Progress.d.ts +3 -8
  134. package/dist/components/Progress.js +7 -10
  135. package/dist/components/PromptInput.d.ts +2 -2
  136. package/dist/components/PromptInput.js +52 -200
  137. package/dist/components/Queue.d.ts +6 -16
  138. package/dist/components/Queue.js +2 -2
  139. package/dist/components/RadioGroup.d.ts +3 -8
  140. package/dist/components/RadioGroup.js +7 -10
  141. package/dist/components/Reasoning.d.ts +4 -8
  142. package/dist/components/Reasoning.js +3 -3
  143. package/dist/components/ResizableSidePanel.js +2 -2
  144. package/dist/components/ResponsiveSidebarShell.d.ts +1 -1
  145. package/dist/components/ResponsiveSidebarShell.js +4 -3
  146. package/dist/components/ScrollArea.d.ts +5 -20
  147. package/dist/components/ScrollArea.js +11 -10
  148. package/dist/components/Select.d.ts +1 -1
  149. package/dist/components/Select.js +32 -55
  150. package/dist/components/Separator.d.ts +1 -5
  151. package/dist/components/Separator.js +3 -6
  152. package/dist/components/Slider.d.ts +6 -19
  153. package/dist/components/Slider.js +15 -14
  154. package/dist/components/Sources.d.ts +4 -9
  155. package/dist/components/Sources.js +3 -2
  156. package/dist/components/Stepper.js +2 -2
  157. package/dist/components/SubagentRunDetails.js +1 -1
  158. package/dist/components/SubagentRunIndicator.js +2 -2
  159. package/dist/components/SubagentRunList.js +1 -2
  160. package/dist/components/SubagentRunSelector.d.ts +2 -11
  161. package/dist/components/SubagentRunSelector.js +16 -15
  162. package/dist/components/Switch.d.ts +2 -5
  163. package/dist/components/Switch.js +5 -8
  164. package/dist/components/Tabs.d.ts +2 -2
  165. package/dist/components/Tabs.js +10 -16
  166. package/dist/components/Task.d.ts +4 -9
  167. package/dist/components/Task.js +4 -3
  168. package/dist/components/Terminal.d.ts +2 -3
  169. package/dist/components/Terminal.js +3 -3
  170. package/dist/components/TestResults.d.ts +4 -9
  171. package/dist/components/TestResults.js +3 -2
  172. package/dist/components/Textarea.js +1 -1
  173. package/dist/components/ThemeModeControl.js +1 -1
  174. package/dist/components/ThinkChat.d.ts +21 -11
  175. package/dist/components/ThinkChat.js +5 -3
  176. package/dist/components/ThinkChatActivity.d.ts +1 -1
  177. package/dist/components/ThinkChatActivity.js +26 -7
  178. package/dist/components/ThinkChatContext.d.ts +1 -1
  179. package/dist/components/ThinkChatToolPanels.js +2 -2
  180. package/dist/components/ThinkExecutionDetail.js +2 -2
  181. package/dist/components/ThinkExecutionStatus.js +2 -2
  182. package/dist/components/ThinkExecutionWorkbench.js +2 -2
  183. package/dist/components/ThinkFullApp.d.ts +33 -9
  184. package/dist/components/ThinkFullApp.js +98 -69
  185. package/dist/components/ThinkFullAppViewSwitch.d.ts +1 -1
  186. package/dist/components/ThinkFullAppViewSwitch.js +2 -2
  187. package/dist/components/ThinkPendingApproval.d.ts +60 -0
  188. package/dist/components/ThinkPendingApproval.js +99 -0
  189. package/dist/components/ThinkRecoveryNotice.d.ts +2 -0
  190. package/dist/components/ThinkRecoveryNotice.js +40 -0
  191. package/dist/components/ThinkRoutine.js +1 -0
  192. package/dist/components/ThinkRoutineBrowser.js +6 -6
  193. package/dist/components/ThinkRoutineDetail.js +1 -1
  194. package/dist/components/ThinkRoutineForm.js +2 -2
  195. package/dist/components/ThinkRoutineLibrary.d.ts +9 -0
  196. package/dist/components/ThinkRoutineLibrary.js +67 -20
  197. package/dist/components/ThinkRoutineRuns.js +1 -1
  198. package/dist/components/ThinkThreadPicker.js +2 -2
  199. package/dist/components/ThinkThreadShell.d.ts +1 -1
  200. package/dist/components/Toast.d.ts +7 -28
  201. package/dist/components/Toast.js +15 -14
  202. package/dist/components/Toggle.d.ts +1 -1
  203. package/dist/components/Toggle.js +5 -5
  204. package/dist/components/ToggleGroup.d.ts +1 -1
  205. package/dist/components/ToggleGroup.js +8 -15
  206. package/dist/components/ToolApproval.d.ts +28 -0
  207. package/dist/components/ToolApproval.js +35 -0
  208. package/dist/components/ToolInvocation.d.ts +26 -0
  209. package/dist/components/ToolInvocation.js +72 -0
  210. package/dist/components/Toolbar.d.ts +6 -24
  211. package/dist/components/Toolbar.js +13 -12
  212. package/dist/components/Tooltip.d.ts +3 -9
  213. package/dist/components/Tooltip.js +7 -10
  214. package/dist/components/WebPreview.d.ts +1 -2
  215. package/dist/components/WebPreview.js +4 -3
  216. package/dist/components/Workspace.d.ts +1 -1
  217. package/dist/components/Workspace.js +5 -20
  218. package/dist/components/WorkspaceBrowser.d.ts +1 -1
  219. package/dist/components/WorkspaceBrowser.js +3 -3
  220. package/dist/components/WorkspaceExplorer.d.ts +3 -31
  221. package/dist/components/WorkspaceExplorer.js +3 -3
  222. package/dist/components/WorkspaceFile.d.ts +1 -1
  223. package/dist/components/WorkspaceFileView.d.ts +1 -1
  224. package/dist/components/WorkspaceFileView.js +1 -1
  225. package/dist/components/WorkspaceHeader.js +1 -1
  226. package/dist/components/WorkspaceLink.js +1 -1
  227. package/dist/components/icons.d.ts +2 -2
  228. package/dist/components/icons.js +2 -2
  229. package/dist/{copy-button-DtPMgN7e.d.ts → copy-button-CQx3LQAC.d.ts} +1 -2
  230. package/dist/{copy-button-Dejn5heL.js → copy-button-cYsJBauI.js} +1 -1
  231. package/dist/{icons-CpfUer49.js → icons--FqCZEc3.js} +3 -2
  232. package/dist/{icons-GQd1xF4e.d.ts → icons-DpUqY8Mp.d.ts} +6 -1
  233. package/dist/styles/agent-activity-preview.css +4 -0
  234. package/dist/styles/agent-chat.css +0 -41
  235. package/dist/styles/agent-connection.css +0 -12
  236. package/dist/styles/agent-tool-detail.css +54 -0
  237. package/dist/styles/approval.css +172 -0
  238. package/dist/styles/artifact.css +0 -12
  239. package/dist/styles/browser-run-panel.css +5 -2
  240. package/dist/styles/chain-of-thought.css +0 -8
  241. package/dist/styles/checkpoint.css +58 -0
  242. package/dist/styles/combobox.css +1 -1
  243. package/dist/styles/commit.css +0 -21
  244. package/dist/styles/context-menu.css +0 -8
  245. package/dist/styles/environment-variables.css +0 -13
  246. package/dist/styles/file-tree.css +0 -16
  247. package/dist/styles/index.css +8 -4
  248. package/dist/styles/inline-citation.css +107 -0
  249. package/dist/styles/mcp-server-picker.css +0 -30
  250. package/dist/styles/menu.css +0 -29
  251. package/dist/styles/menubar.css +0 -8
  252. package/dist/styles/message-scroller.css +0 -12
  253. package/dist/styles/message.css +0 -12
  254. package/dist/styles/model-selector.css +0 -20
  255. package/dist/styles/plan.css +127 -0
  256. package/dist/styles/popover.css +0 -36
  257. package/dist/styles/prompt-input.css +2 -195
  258. package/dist/styles/recipes.css +114 -5
  259. package/dist/styles/responsive-sidebar-shell.css +16 -19
  260. package/dist/styles/sources.css +0 -8
  261. package/dist/styles/subagent-run.css +12 -70
  262. package/dist/styles/task.css +0 -16
  263. package/dist/styles/test-results.css +0 -13
  264. package/dist/styles/think-full-app.css +12 -38
  265. package/dist/styles/think-routine-library.css +12 -20
  266. package/dist/styles/think-thread-picker.css +15 -0
  267. package/dist/styles/toast.css +0 -7
  268. package/dist/styles/utilities.css +31 -0
  269. package/dist/styles/web-preview.css +0 -21
  270. package/dist/styles/workspace-explorer.css +5 -55
  271. package/dist/think-agent-Cip5KAPj.d.ts +7 -0
  272. package/dist/utils/codex-model-catalog.d.ts +4 -4
  273. package/dist/utils/structured-code.d.ts +1 -1
  274. package/dist/workspace-path-L_KmjRjq.js +26 -0
  275. package/package.json +3 -4
  276. package/dist/class-names-9UtZwb0J.js +0 -12
  277. package/dist/components/AppFrame.d.ts +0 -24
  278. package/dist/components/AppFrame.js +0 -25
  279. package/dist/components/Shell.d.ts +0 -163
  280. package/dist/components/Shell.js +0 -137
  281. package/dist/components/SubagentRun.d.ts +0 -86
  282. package/dist/components/SubagentRun.js +0 -108
  283. package/dist/styles/app-frame.css +0 -15
  284. package/dist/styles/shell.css +0 -122
@@ -1,5 +1,5 @@
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";
1
+ import { t as cx } from "../class-names-Bk-QLWWI.js";
2
+ import { C as InfoIcon, N as PauseIcon, V as SpinnerIcon, X as XIcon, s as CheckIcon } from "../icons--FqCZEc3.js";
3
3
  import { Tooltip } from "./Tooltip.js";
4
4
  import { formatThinkExecutionStatus, getThinkExecutionRunStatus, getThinkExecutionRunStatusTone } from "./ThinkExecutionRun.js";
5
5
  import "react";
@@ -1,5 +1,5 @@
1
- import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { L as RefreshIcon, h as EllipsisIcon } from "../icons-CpfUer49.js";
1
+ import { t as cx } from "../class-names-Bk-QLWWI.js";
2
+ import { R as RefreshIcon, g as EllipsisIcon } from "../icons--FqCZEc3.js";
3
3
  import { Button } from "./Button.js";
4
4
  import { Tooltip } from "./Tooltip.js";
5
5
  import { Menu } from "./Menu.js";
@@ -1,21 +1,18 @@
1
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
+ import { r as WorkspaceFileAssetResolver } from "../WorkspaceFile-C8UzuSH4.js";
3
+ import { r as WorkspaceSource } from "../Workspace-C9RFoxcu.js";
4
4
  import { ThinkChatMessagesProps } from "./ThinkChat.js";
5
+ import { t as ThinkAgent } from "../think-agent-Cip5KAPj.js";
5
6
  import { t as ThinkExecutionRun } from "../ThinkExecutionRun-ChhWhOoU.js";
6
7
  import { ThinkFullAppView } from "./ThinkFullAppViewSwitch.js";
7
8
  import { ThinkThreadStatusSummary } from "./ThinkThreadPicker.js";
8
9
  import { ThinkThreadShell } from "./ThinkThreadShell.js";
9
10
  import * as React from "react";
10
- import { useAgentChat } from "@cloudflare/think/react";
11
11
  import { UIMessage } from "ai";
12
- import { useAgent } from "agents/react";
13
- import { Think } from "@cloudflare/think";
12
+ import { useAgentChat } from "@cloudflare/think/react";
13
+ import { UseAgentOptions, useAgent } from "agents/react";
14
+ import { AgentToolRunState } from "agents/agent-tools";
14
15
 
15
- //#region src/components/_internal/think-agent.d.ts
16
- /** Shared complete Think specialization for stateful React agent hooks. */
17
- type ThinkAgent<State = unknown> = Think<object, State>;
18
- //#endregion
19
16
  //#region src/components/ThinkFullApp.d.ts
20
17
  type ThinkFullAppMobileView = "chat" | "workbench";
21
18
  type ThinkFullAppAgent<State = unknown> = ThinkAgent<State>;
@@ -65,6 +62,26 @@ interface ThinkFullAppProps<AgentT extends ThinkFullAppAgent<State>, State = unk
65
62
  messages?: ThinkChatMessagesProps<MessageT>;
66
63
  /** Extra workbench panels appended after the built-in Files and Execution panels. */
67
64
  workbenchPanels?: readonly ThinkFullAppPanel<AgentT, State, MessageT>[];
65
+ /** Show retained Agent Tool runs from the parent connection. Defaults to true. */
66
+ showAgentTools?: boolean;
67
+ /** Selected retained run id. Omit for internal selection state. */
68
+ selectedAgentToolRunId?: string | null;
69
+ /** Initial retained run selection when uncontrolled. */
70
+ defaultSelectedAgentToolRunId?: string | null;
71
+ /** Receives the complete upstream retained run selected from a Nanite pill. */
72
+ onSelectedAgentToolRunChange?: (run: AgentToolRunState<MessageT["parts"][number]> | null) => void;
73
+ /**
74
+ * Whole upstream connection options for child routing, including app auth or
75
+ * query configuration. The selected run's `subAgent` segment is appended.
76
+ */
77
+ agentToolChildConnection?: UseAgentOptions<unknown>;
78
+ /** Child transcript rendering overrides; the composer remains hidden. */
79
+ agentToolMessages?: ThinkChatMessagesProps<MessageT>;
80
+ /**
81
+ * App-owned detail for retained children that do not expose Think chat or
82
+ * require a product-specific route. The whole upstream run stays intact.
83
+ */
84
+ renderAgentToolDetail?: (run: AgentToolRunState<MessageT["parts"][number]>, onBack: () => void) => React.ReactNode;
68
85
  /**
69
86
  * Optional parent-owned thread picker/sidebar rendered beside the selected child app.
70
87
  * Use the render form to close the compact drawer after selecting a thread.
@@ -92,22 +109,29 @@ interface ThinkFullAppProps<AgentT extends ThinkFullAppAgent<State>, State = unk
92
109
  /** Combines ThinkChat with an optional resizable workbench shell. */
93
110
  declare function ThinkFullApp<AgentT extends ThinkFullAppAgent<State>, State = unknown, MessageT extends UIMessage = UIMessage>({
94
111
  agent,
112
+ agentToolChildConnection,
113
+ agentToolMessages,
95
114
  appBarActions,
96
115
  appBarLeading,
97
116
  appBarTitle,
98
117
  chat,
99
118
  className,
100
119
  defaultMobileView,
120
+ defaultSelectedAgentToolRunId,
101
121
  defaultWorkbenchView,
102
122
  defaultThreadSidebarOpen,
103
123
  messages,
104
124
  mobileView,
105
125
  onMobileViewChange,
126
+ onSelectedAgentToolRunChange,
106
127
  onSelectedExecutionRunChange,
107
128
  onThreadSidebarOpenChange,
108
129
  onWorkbenchViewChange,
109
130
  ref,
131
+ renderAgentToolDetail,
132
+ selectedAgentToolRunId,
110
133
  selectedExecutionRun,
134
+ showAgentTools,
111
135
  showExecutionWorkbench,
112
136
  style,
113
137
  threadSidebar,
@@ -1,19 +1,22 @@
1
- import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { G as TerminalIcon, s as ChevronDownIcon, v as FileIcon } from "../icons-CpfUer49.js";
1
+ import { t as cx } from "../class-names-Bk-QLWWI.js";
2
+ import { K as TerminalIcon, c as ChevronDownIcon, y as FileIcon } from "../icons--FqCZEc3.js";
3
3
  import { Button } from "./Button.js";
4
- import { a as WorkspaceNavigationRestorationBoundary, i as WorkspaceNavigationFocusRestorer, n as WorkspaceNavigationProvider } from "../WorkspaceLink-DIPbXrUM.js";
4
+ import { a as WorkspaceNavigationRestorationBoundary, i as WorkspaceNavigationFocusRestorer, n as WorkspaceNavigationProvider } from "../WorkspaceLink-B1ykV1dS.js";
5
5
  import { n as mergeRefs } from "../merge-refs-DF_7w2x_.js";
6
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";
7
+ import { NaniteMark } from "./NaniteScene.js";
8
+ import { o as useThinkPendingApprovals, s as resolveThinkApprovalProps, t as ThinkChat } from "../ThinkChat-DInElus-.js";
9
9
  import { useWorkspace } from "./Workspace.js";
10
10
  import { WorkspaceExplorer } from "./WorkspaceExplorer.js";
11
+ import { SelectedAgentToolChild } from "./AgentToolDetail.js";
12
+ import { ResizableSidePanel } from "./ResizableSidePanel.js";
11
13
  import { ThinkExecutionWorkbench } from "./ThinkExecutionWorkbench.js";
12
14
  import { ThinkFullAppViewSwitch } from "./ThinkFullAppViewSwitch.js";
13
15
  import { ThinkThreadStatusIndicators } from "./ThinkThreadPicker.js";
14
16
  import { ThinkThreadShell } from "./ThinkThreadShell.js";
15
17
  import * as React from "react";
16
18
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
19
+ import { useAgentToolEvents } from "agents/react";
17
20
  //#region src/components/ThinkFullApp.tsx
18
21
  const workbenchPanelDefaultWidth = 340;
19
22
  const workbenchPanelMinWidth = 300;
@@ -34,8 +37,9 @@ function WorkspacePanel({ config, workbenchNavigation }) {
34
37
  });
35
38
  }
36
39
  /** Combines ThinkChat with an optional resizable workbench shell. */
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 }) {
40
+ function ThinkFullApp({ agent, agentToolChildConnection, agentToolMessages, appBarActions, appBarLeading, appBarTitle, chat, className, defaultMobileView, defaultSelectedAgentToolRunId, defaultWorkbenchView, defaultThreadSidebarOpen, messages, mobileView, onMobileViewChange, onSelectedAgentToolRunChange, onSelectedExecutionRunChange, onThreadSidebarOpenChange, onWorkbenchViewChange, ref, renderAgentToolDetail, selectedAgentToolRunId, selectedExecutionRun, showAgentTools = true, showExecutionWorkbench = true, style, threadSidebar, threadSidebarOpen, threadStatusSummary, workbenchPanels, workbenchView, workspace, ...props }) {
38
41
  const appRef = React.useRef(null);
42
+ const agentToolTriggerRef = React.useRef(null);
39
43
  const approvals = useThinkPendingApprovals(agent.stub, `${chat.messages.length}:${chat.status}`);
40
44
  const resolvedMessages = React.useMemo(() => {
41
45
  const approvalProps = resolveThinkApprovalProps({
@@ -59,6 +63,49 @@ function ThinkFullApp({ agent, appBarActions, appBarLeading, appBarTitle, chat,
59
63
  ]);
60
64
  const [innerMobileView, setInnerMobileView] = React.useState(defaultMobileView ?? "chat");
61
65
  const [innerWorkbenchView, setInnerWorkbenchView] = React.useState(defaultWorkbenchView ?? "files");
66
+ const [innerSelectedAgentToolRunId, setInnerSelectedAgentToolRunId] = React.useState(defaultSelectedAgentToolRunId ?? null);
67
+ const agentTools = useAgentToolEvents({ agent });
68
+ const agentIdentity = JSON.stringify(agent.path);
69
+ const requestedMobileView = mobileView ?? innerMobileView;
70
+ const requestedWorkbenchView = workbenchView ?? innerWorkbenchView;
71
+ const activeAgentToolRunId = selectedAgentToolRunId ?? innerSelectedAgentToolRunId;
72
+ const selectedAgentToolRun = activeAgentToolRunId ? agentTools.runsById[activeAgentToolRunId] : void 0;
73
+ React.useEffect(() => {
74
+ agentTools.resetLocalState();
75
+ setInnerSelectedAgentToolRunId(null);
76
+ }, [agentIdentity]);
77
+ const setWorkbenchView = React.useCallback((next) => {
78
+ if (workbenchView === void 0) setInnerWorkbenchView(next);
79
+ onWorkbenchViewChange?.(next);
80
+ }, [onWorkbenchViewChange, workbenchView]);
81
+ const setMobileView = React.useCallback((next) => {
82
+ if (mobileView === void 0) setInnerMobileView(next);
83
+ onMobileViewChange?.(next);
84
+ }, [mobileView, onMobileViewChange]);
85
+ const updateSelectedAgentToolRun = React.useCallback((run) => {
86
+ if (selectedAgentToolRunId === void 0) setInnerSelectedAgentToolRunId(run?.runId ?? null);
87
+ onSelectedAgentToolRunChange?.(run);
88
+ }, [onSelectedAgentToolRunChange, selectedAgentToolRunId]);
89
+ const selectAgentToolRun = React.useCallback((run) => {
90
+ const trigger = document.activeElement;
91
+ if (trigger instanceof HTMLElement && appRef.current?.contains(trigger)) agentToolTriggerRef.current = trigger;
92
+ updateSelectedAgentToolRun(run);
93
+ setWorkbenchView("agent-tool");
94
+ setMobileView("workbench");
95
+ }, [
96
+ setMobileView,
97
+ setWorkbenchView,
98
+ updateSelectedAgentToolRun
99
+ ]);
100
+ const closeAgentToolDetail = React.useCallback(() => {
101
+ const trigger = agentToolTriggerRef.current;
102
+ agentToolTriggerRef.current = null;
103
+ updateSelectedAgentToolRun(null);
104
+ setMobileView("chat");
105
+ requestAnimationFrame(() => {
106
+ if (trigger?.isConnected) trigger.focus();
107
+ });
108
+ }, [setMobileView, updateSelectedAgentToolRun]);
62
109
  const panelContext = React.useMemo(() => ({
63
110
  agent,
64
111
  chat,
@@ -68,35 +115,41 @@ function ThinkFullApp({ agent, appBarActions, appBarLeading, appBarTitle, chat,
68
115
  chat,
69
116
  workspace
70
117
  ]);
71
- const availableWorkbenchPanels = React.useMemo(() => {
72
- const builtInPanels = [];
73
- if (workspace !== void 0) builtInPanels.push({
74
- id: "files",
75
- label: "Files",
76
- icon: /* @__PURE__ */ jsx(FileIcon, {}),
77
- render: () => /* @__PURE__ */ jsx(WorkspacePanel, { config: workspace })
78
- });
79
- if (showExecutionWorkbench) builtInPanels.push({
80
- id: "execution",
81
- label: "Execution",
82
- icon: /* @__PURE__ */ jsx(TerminalIcon, {}),
83
- render: ({ agent }) => /* @__PURE__ */ jsx(ThinkExecutionWorkbench, {
84
- source: agent.stub,
85
- title: "Execution",
86
- selectedRun: selectedExecutionRun,
87
- onSelectedRunChange: onSelectedExecutionRunChange
88
- })
89
- });
90
- return workbenchPanels ? [...builtInPanels, ...workbenchPanels] : builtInPanels;
91
- }, [
92
- onSelectedExecutionRunChange,
93
- selectedExecutionRun,
94
- showExecutionWorkbench,
95
- workbenchPanels,
96
- workspace
97
- ]);
98
- const requestedMobileView = mobileView ?? innerMobileView;
99
- const requestedWorkbenchView = workbenchView ?? innerWorkbenchView;
118
+ const availableWorkbenchPanels = [];
119
+ if (workspace !== void 0) availableWorkbenchPanels.push({
120
+ id: "files",
121
+ label: "Files",
122
+ icon: /* @__PURE__ */ jsx(FileIcon, {}),
123
+ render: () => /* @__PURE__ */ jsx(WorkspacePanel, {
124
+ config: workspace,
125
+ workbenchNavigation
126
+ })
127
+ });
128
+ if (showExecutionWorkbench) availableWorkbenchPanels.push({
129
+ id: "execution",
130
+ label: "Execution",
131
+ icon: /* @__PURE__ */ jsx(TerminalIcon, {}),
132
+ render: ({ agent }) => /* @__PURE__ */ jsx(ThinkExecutionWorkbench, {
133
+ source: agent.stub,
134
+ title: "Execution",
135
+ backButton: workbenchNavigation,
136
+ selectedRun: selectedExecutionRun,
137
+ onSelectedRunChange: onSelectedExecutionRunChange
138
+ })
139
+ });
140
+ if (showAgentTools && selectedAgentToolRun) availableWorkbenchPanels.push({
141
+ id: "agent-tool",
142
+ label: "Agent",
143
+ icon: /* @__PURE__ */ jsx(NaniteMark, { index: selectedAgentToolRun.order }),
144
+ render: () => renderAgentToolDetail ? renderAgentToolDetail(selectedAgentToolRun, closeAgentToolDetail) : /* @__PURE__ */ jsx(SelectedAgentToolChild, {
145
+ run: selectedAgentToolRun,
146
+ parentAgent: agent,
147
+ connectionOptions: agentToolChildConnection,
148
+ messages: agentToolMessages,
149
+ onBack: closeAgentToolDetail
150
+ }, selectedAgentToolRun.runId)
151
+ });
152
+ if (workbenchPanels) availableWorkbenchPanels.push(...workbenchPanels);
100
153
  const activePanel = availableWorkbenchPanels.find((panel) => panel.id === requestedWorkbenchView) ?? availableWorkbenchPanels[0];
101
154
  const activeWorkbenchView = activePanel?.id;
102
155
  const hasWorkbench = activePanel !== void 0;
@@ -108,14 +161,6 @@ function ThinkFullApp({ agent, appBarActions, appBarLeading, appBarTitle, chat,
108
161
  const shouldRenderInlineAppBar = !threadSidebar && (hasApplicationChrome || hasWorkbench);
109
162
  const hasCompactAppBar = shouldRenderInlineAppBar && !hasApplicationChrome && canEmbedWorkbenchNavigation;
110
163
  const hasAppBarRow = shouldRenderInlineAppBar && !hasCompactAppBar;
111
- const setWorkbenchView = React.useCallback((next) => {
112
- if (workbenchView === void 0) setInnerWorkbenchView(next);
113
- onWorkbenchViewChange?.(next);
114
- }, [onWorkbenchViewChange, workbenchView]);
115
- const setMobileView = React.useCallback((next) => {
116
- if (mobileView === void 0) setInnerMobileView(next);
117
- onMobileViewChange?.(next);
118
- }, [mobileView, onMobileViewChange]);
119
164
  const workbenchNavigation = showWorkbenchViewSwitch ? /* @__PURE__ */ jsx(ThinkFullAppViewSwitch, {
120
165
  className: "think-full-app__embedded-view-switch",
121
166
  views: workbenchViews,
@@ -206,24 +251,17 @@ function ThinkFullApp({ agent, appBarActions, appBarLeading, appBarTitle, chat,
206
251
  "aria-label": "Chat",
207
252
  children: /* @__PURE__ */ jsx("div", {
208
253
  className: "think-full-app__chat",
209
- children: /* @__PURE__ */ jsxs("div", {
254
+ children: /* @__PURE__ */ jsx("div", {
210
255
  className: "think-full-app__chat-inner",
211
- children: [/* @__PURE__ */ jsx(ThinkChat.Provider, {
256
+ children: /* @__PURE__ */ jsx(ThinkChat.Provider, {
212
257
  chat,
213
- children: /* @__PURE__ */ jsx(ThinkChat.Messages, { ...resolvedMessages })
214
- }), chat.error ? /* @__PURE__ */ jsxs("div", {
215
- className: "think-full-app__error",
216
- role: "alert",
217
- children: [chat.error.message, /* @__PURE__ */ jsx(Button, {
218
- type: "button",
219
- variant: "link",
220
- color: "neutral",
221
- size: "xs",
222
- className: "think-full-app__error-dismiss",
223
- onClick: () => chat.clearError(),
224
- children: "Dismiss"
225
- })]
226
- }) : null]
258
+ agentTools,
259
+ children: /* @__PURE__ */ jsx(ThinkChat.Messages, {
260
+ ...resolvedMessages,
261
+ selectedAgentToolRunId: activeAgentToolRunId,
262
+ onAgentToolRunSelect: showAgentTools ? selectAgentToolRun : void 0
263
+ })
264
+ })
227
265
  })
228
266
  })
229
267
  }),
@@ -235,16 +273,7 @@ function ThinkFullApp({ agent, appBarActions, appBarLeading, appBarTitle, chat,
235
273
  children: /* @__PURE__ */ jsx("div", {
236
274
  className: "think-full-app__workbench-panel",
237
275
  "data-view": activeWorkbenchView,
238
- children: activeWorkbenchView === "files" && workspace ? /* @__PURE__ */ jsx(WorkspacePanel, {
239
- config: workspace,
240
- workbenchNavigation
241
- }) : activeWorkbenchView === "execution" ? /* @__PURE__ */ jsx(ThinkExecutionWorkbench, {
242
- source: agent.stub,
243
- title: "Execution",
244
- backButton: workbenchNavigation,
245
- selectedRun: selectedExecutionRun,
246
- onSelectedRunChange: onSelectedExecutionRunChange
247
- }) : activePanel.render(panelContext)
276
+ children: activePanel.render(panelContext)
248
277
  })
249
278
  })
250
279
  })] }) : null
@@ -1,4 +1,4 @@
1
- import { r as ToggleGroupProps } from "../ToggleGroup-8hPv-b69.js";
1
+ import { r as ToggleGroupProps } from "../ToggleGroup-yseEWkOC.js";
2
2
  import * as React from "react";
3
3
 
4
4
  //#region src/components/ThinkFullAppViewSwitch.d.ts
@@ -1,4 +1,4 @@
1
- import { t as cx } from "../class-names-9UtZwb0J.js";
1
+ import { n as mergeBaseClassName } from "../class-names-Bk-QLWWI.js";
2
2
  import { AppTopBar } from "./AppTopBar.js";
3
3
  import { ToggleGroup } from "./ToggleGroup.js";
4
4
  import "react";
@@ -11,7 +11,7 @@ import { jsx } from "react/jsx-runtime";
11
11
  */
12
12
  function ThinkFullAppViewSwitch({ allowEmpty = false, className, onValueChange, value, views, ...props }) {
13
13
  return /* @__PURE__ */ jsx(ToggleGroup.Root, {
14
- className: cx("think-full-app__view-switch", className),
14
+ className: mergeBaseClassName("think-full-app__view-switch", className),
15
15
  size: "sm",
16
16
  value: value ? [value] : [],
17
17
  onValueChange: (nextValue, eventDetails) => {
@@ -0,0 +1,60 @@
1
+ import * as React from "react";
2
+ import { DynamicToolUIPart, ToolUIPart } from "ai";
3
+ import { PendingApproval, Think } from "@cloudflare/think";
4
+ import { AgentStub } from "agents/client";
5
+ import { ProxyToolOutput } from "@cloudflare/codemode";
6
+
7
+ //#region src/components/ThinkPendingApproval.d.ts
8
+ type PausedExecution = Extract<ProxyToolOutput, {
9
+ status: "paused";
10
+ }>;
11
+ /** Structural match for any upstream tool binding of the Codemode execute runtime. */
12
+ declare function getPausedExecution(part: ToolUIPart | DynamicToolUIPart): PausedExecution | undefined;
13
+ interface SharedThinkApprovalProps {
14
+ thinkStub: AgentStub<Think>;
15
+ onSettled?: () => void | Promise<void>;
16
+ onSkip?: () => void;
17
+ count?: number;
18
+ question?: React.ReactNode;
19
+ }
20
+ interface ThinkPendingApprovalProps extends React.HTMLAttributes<HTMLDivElement>, SharedThinkApprovalProps {
21
+ /** Whole entry returned by Think `pendingApprovals()`. */
22
+ approval: PendingApproval;
23
+ }
24
+ /**
25
+ * Durable Think approval adapter. It renders the complete upstream descriptor
26
+ * and resolves only through the full Think stub's idempotent execution RPCs.
27
+ */
28
+ declare function ThinkPendingApproval({
29
+ approval,
30
+ className,
31
+ count,
32
+ onSettled,
33
+ onSkip,
34
+ question,
35
+ ref,
36
+ thinkStub,
37
+ ...props
38
+ }: ThinkPendingApprovalProps & {
39
+ ref?: React.Ref<HTMLDivElement>;
40
+ }): React.JSX.Element;
41
+ interface ThinkExecutionApprovalProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "part">, SharedThinkApprovalProps {
42
+ /** Whole AI SDK tool part whose upstream Codemode output may be paused. */
43
+ part: ToolUIPart | DynamicToolUIPart;
44
+ }
45
+ /** Actionable adapter for Think's in-band paused Codemode execution output. */
46
+ declare function ThinkExecutionApproval({
47
+ className,
48
+ count,
49
+ onSettled,
50
+ onSkip,
51
+ part,
52
+ question,
53
+ ref,
54
+ thinkStub,
55
+ ...props
56
+ }: ThinkExecutionApprovalProps & {
57
+ ref?: React.Ref<HTMLDivElement>;
58
+ }): React.JSX.Element | null;
59
+ //#endregion
60
+ export { ThinkExecutionApproval, ThinkExecutionApprovalProps, ThinkPendingApproval, ThinkPendingApprovalProps, getPausedExecution };
@@ -0,0 +1,99 @@
1
+ import { Approval, ApprovalCount, ApprovalDecision, ApprovalHeader, ApprovalInputPreview, ApprovalPreview, ApprovalPreviewRow, ApprovalQuestion, formatApprovalValue } from "./Approval.js";
2
+ import "react";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { getToolName } from "ai";
5
+ import { getToolOutput } from "@cloudflare/think/react";
6
+ //#region src/components/ThinkPendingApproval.tsx
7
+ /** Structural match for any upstream tool binding of the Codemode execute runtime. */
8
+ function getPausedExecution(part) {
9
+ if (part.state !== "output-available") return void 0;
10
+ const output = getToolOutput(part);
11
+ return output?.status === "paused" && typeof output.executionId === "string" ? output : void 0;
12
+ }
13
+ function titleCase(value) {
14
+ return value.split("-").map((word) => `${word.charAt(0).toUpperCase()}${word.slice(1)}`).join(" ");
15
+ }
16
+ /**
17
+ * Durable Think approval adapter. It renders the complete upstream descriptor
18
+ * and resolves only through the full Think stub's idempotent execution RPCs.
19
+ */
20
+ function ThinkPendingApproval({ approval, className, count, onSettled, onSkip, question, ref, thinkStub, ...props }) {
21
+ const { descriptor } = approval;
22
+ const permissions = descriptor.permissions.length ? descriptor.permissions.join(", ") : "None requested";
23
+ const source = approval.source === "action" ? "Action" : "Codemode";
24
+ return /* @__PURE__ */ jsxs(Approval, {
25
+ ref,
26
+ className,
27
+ "aria-label": `Approve ${descriptor.action}`,
28
+ ...props,
29
+ children: [
30
+ /* @__PURE__ */ jsxs(ApprovalHeader, { children: [/* @__PURE__ */ jsx(ApprovalQuestion, { children: question ?? /* @__PURE__ */ jsxs(Fragment, { children: [
31
+ "Do you want to allow ",
32
+ /* @__PURE__ */ jsx("code", { children: descriptor.summary }),
33
+ "?"
34
+ ] }) }), count && count > 1 ? /* @__PURE__ */ jsxs(ApprovalCount, { children: ["1 of ", count] }) : null] }),
35
+ /* @__PURE__ */ jsxs(ApprovalPreview, { children: [
36
+ /* @__PURE__ */ jsx(ApprovalPreviewRow, {
37
+ label: "source",
38
+ children: source
39
+ }),
40
+ /* @__PURE__ */ jsx(ApprovalPreviewRow, {
41
+ label: "kind",
42
+ children: titleCase(descriptor.kind)
43
+ }),
44
+ /* @__PURE__ */ jsx(ApprovalPreviewRow, {
45
+ label: "risk",
46
+ children: descriptor.risk ? titleCase(descriptor.risk) : "Not specified"
47
+ }),
48
+ /* @__PURE__ */ jsx(ApprovalPreviewRow, {
49
+ label: "permissions",
50
+ children: permissions
51
+ })
52
+ ] }),
53
+ descriptor.input !== void 0 ? /* @__PURE__ */ jsx(ApprovalInputPreview, { input: descriptor.input }) : null,
54
+ /* @__PURE__ */ jsx(ApprovalDecision, {
55
+ subject: descriptor.summary,
56
+ onSkip,
57
+ onDecision: async ({ approved, reason }) => {
58
+ try {
59
+ await (approved ? thinkStub.approveExecution(approval.executionId) : thinkStub.rejectExecution(approval.executionId, reason));
60
+ } finally {
61
+ await onSettled?.();
62
+ }
63
+ }
64
+ }, approval.executionId)
65
+ ]
66
+ });
67
+ }
68
+ /** Actionable adapter for Think's in-band paused Codemode execution output. */
69
+ function ThinkExecutionApproval({ className, count, onSettled, onSkip, part, question, ref, thinkStub, ...props }) {
70
+ const paused = getPausedExecution(part);
71
+ if (!paused) return null;
72
+ const toolName = part.title ?? getToolName(part);
73
+ return /* @__PURE__ */ jsxs(Approval, {
74
+ ref,
75
+ className,
76
+ "aria-label": `Approve ${toolName}`,
77
+ ...props,
78
+ children: [
79
+ /* @__PURE__ */ jsxs(ApprovalHeader, { children: [/* @__PURE__ */ jsx(ApprovalQuestion, { children: question ?? /* @__PURE__ */ jsx(Fragment, { children: "The agent's code is paused on these calls. Allow it to continue?" }) }), count && count > 1 ? /* @__PURE__ */ jsxs(ApprovalCount, { children: ["1 of ", count] }) : null] }),
80
+ /* @__PURE__ */ jsx(ApprovalPreview, { children: paused.pending.map((action) => /* @__PURE__ */ jsx(ApprovalPreviewRow, {
81
+ label: `${action.connector}.${action.method}`,
82
+ children: action.args === void 0 ? null : formatApprovalValue(action.args)
83
+ }, action.seq)) }),
84
+ /* @__PURE__ */ jsx(ApprovalDecision, {
85
+ subject: toolName,
86
+ onSkip,
87
+ onDecision: async ({ approved, reason }) => {
88
+ try {
89
+ await (approved ? thinkStub.approveExecution(paused.executionId) : thinkStub.rejectExecution(paused.executionId, reason));
90
+ } finally {
91
+ await onSettled?.();
92
+ }
93
+ }
94
+ }, `${paused.executionId}:${paused.pending[0]?.seq ?? "pending"}`)
95
+ ]
96
+ });
97
+ }
98
+ //#endregion
99
+ export { ThinkExecutionApproval, ThinkPendingApproval, getPausedExecution };
@@ -0,0 +1,2 @@
1
+ import { n as ThinkRecoveryNoticeProps, t as ThinkRecoveryNotice } from "../ThinkRecoveryNotice-DFIcG9UX.js";
2
+ export { ThinkRecoveryNotice, ThinkRecoveryNoticeProps };
@@ -0,0 +1,40 @@
1
+ import { AgentChatTurnError } from "./AgentChatTurnError.js";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ //#region src/components/ThinkRecoveryNotice.tsx
4
+ function connectionReason(error) {
5
+ return error.reason.trim() || error.message.trim();
6
+ }
7
+ /**
8
+ * Native Think recovery, connection, and turn-error content for AgentChat's
9
+ * persistent polite notice region. Think exposes no recovery phase, progress,
10
+ * checkpoint, attempt count, or timeline to the browser, so this adapter does
11
+ * not claim those details.
12
+ */
13
+ function ThinkRecoveryNotice({ chat }) {
14
+ if (chat.isRecovering) return /* @__PURE__ */ jsx("span", {
15
+ "data-slot": "think-recovery-notice",
16
+ children: "Recovering the interrupted response…"
17
+ });
18
+ if (chat.connectionError) {
19
+ const reason = connectionReason(chat.connectionError);
20
+ return /* @__PURE__ */ jsxs("span", {
21
+ "data-slot": "think-recovery-notice",
22
+ "data-tone": "danger",
23
+ children: ["Connection lost", reason ? ` — ${reason}` : "."]
24
+ });
25
+ }
26
+ if (chat.error) {
27
+ const retryMessageId = chat.messages.findLast((message) => message.role !== "system")?.id;
28
+ return /* @__PURE__ */ jsx(AgentChatTurnError, {
29
+ error: chat.error,
30
+ onDismiss: chat.clearError,
31
+ onRetry: retryMessageId ? () => {
32
+ chat.clearError();
33
+ chat.regenerate({ messageId: retryMessageId });
34
+ } : void 0
35
+ });
36
+ }
37
+ return null;
38
+ }
39
+ //#endregion
40
+ export { ThinkRecoveryNotice };
@@ -1,5 +1,6 @@
1
1
  //#region src/components/ThinkRoutine.ts
2
2
  function getThinkRoutineNextRun(routine) {
3
+ if (!routine.enabled) return "Paused";
3
4
  return routine.schedule ? formatThinkExecutionDate(routine.schedule.time * 1e3, "Not scheduled") : "Pending reconciliation";
4
5
  }
5
6
  function formatThinkExecutionDate(value, fallback) {
@@ -1,5 +1,5 @@
1
- import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { F as PlusIcon, R as SearchIcon } from "../icons-CpfUer49.js";
1
+ import { t as cx } from "../class-names-Bk-QLWWI.js";
2
+ import { I as PlusIcon, z as SearchIcon } from "../icons--FqCZEc3.js";
3
3
  import { Button } from "./Button.js";
4
4
  import { Tooltip } from "./Tooltip.js";
5
5
  import { Field } from "./Field.js";
@@ -34,7 +34,7 @@ function ThinkRoutineBrowser({ className, routines, selectedRoutineId, onSelecte
34
34
  ...props,
35
35
  children: [
36
36
  /* @__PURE__ */ jsx("h2", {
37
- className: "think-routine-library__title",
37
+ className: "think-routine-library__title sigvelo-visually-hidden",
38
38
  children: "Schedules"
39
39
  }),
40
40
  /* @__PURE__ */ jsxs("div", {
@@ -79,7 +79,7 @@ function ThinkRoutineBrowser({ className, routines, selectedRoutineId, onSelecte
79
79
  className: "think-routine-library__search",
80
80
  name: "routine-search",
81
81
  children: [/* @__PURE__ */ jsx(Field.Label, {
82
- className: "think-routine-library__title",
82
+ className: "think-routine-library__title sigvelo-visually-hidden",
83
83
  children: "Search schedules"
84
84
  }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(SearchIcon, {}), /* @__PURE__ */ jsx(Field.Control, {
85
85
  className: "think-routine-browser__search-control",
@@ -94,7 +94,7 @@ function ThinkRoutineBrowser({ className, routines, selectedRoutineId, onSelecte
94
94
  })] })]
95
95
  }),
96
96
  /* @__PURE__ */ jsxs("p", {
97
- className: "think-routine-library__status",
97
+ className: "think-routine-library__status sigvelo-visually-hidden",
98
98
  role: "status",
99
99
  "aria-atomic": "true",
100
100
  children: [
@@ -126,7 +126,7 @@ function ThinkRoutineBrowser({ className, routines, selectedRoutineId, onSelecte
126
126
  "aria-hidden": "true"
127
127
  }),
128
128
  /* @__PURE__ */ jsx("span", {
129
- className: "think-routine-library__title",
129
+ className: "think-routine-library__title sigvelo-visually-hidden",
130
130
  children: routine.enabled ? "Active" : "Paused"
131
131
  }),
132
132
  /* @__PURE__ */ jsxs("span", {
@@ -1,4 +1,4 @@
1
- import { t as cx } from "../class-names-9UtZwb0J.js";
1
+ import { t as cx } from "../class-names-Bk-QLWWI.js";
2
2
  import { Badge } from "./Badge.js";
3
3
  import { Switch } from "./Switch.js";
4
4
  import { getThinkRoutineNextRun } from "./ThinkRoutine.js";
@@ -1,5 +1,5 @@
1
- import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { B as SpinnerIcon } from "../icons-CpfUer49.js";
1
+ import { t as cx } from "../class-names-Bk-QLWWI.js";
2
+ import { V as SpinnerIcon } from "../icons--FqCZEc3.js";
3
3
  import { Button } from "./Button.js";
4
4
  import { Field } from "./Field.js";
5
5
  import { Form } from "./Form.js";
@@ -27,8 +27,14 @@ interface ThinkRoutineLibraryProps<TRoutine extends ThinkRoutine = ThinkRoutine>
27
27
  defaultSelectedRoutineId?: string;
28
28
  /** Called when the user selects a routine from the collection. */
29
29
  onSelectedRoutineIdChange?: (routineId: string) => void;
30
+ /** Product navigation rendered after the built-in schedule navigation control. */
31
+ appBarLeading?: React.ReactNode;
32
+ /** Opens a host-owned create route instead of the library's built-in form. */
33
+ onCreateRoutineRequest?: () => void;
30
34
  /** Creates an app-owned routine from a whole native Think scheduled task. */
31
35
  onCreateRoutine?: (request: ThinkRoutineCreateRequest) => void | Promise<void>;
36
+ /** Opens a host-owned editor for the selected routine. */
37
+ onEditRoutine?: (routine: TRoutine) => void;
32
38
  /** Starts the selected routine immediately. */
33
39
  onRunRoutine?: (routine: TRoutine) => void | Promise<void>;
34
40
  /** Activates or pauses the selected app-owned routine. */
@@ -52,10 +58,13 @@ interface ThinkRoutineLibraryProps<TRoutine extends ThinkRoutine = ThinkRoutine>
52
58
  * surfaces independently.
53
59
  */
54
60
  declare function ThinkRoutineLibrary<TRoutine extends ThinkRoutine = ThinkRoutine>({
61
+ appBarLeading,
55
62
  className,
56
63
  defaultSelectedRoutineId,
57
64
  onCreateRoutine,
65
+ onCreateRoutineRequest,
58
66
  onDeleteRoutine,
67
+ onEditRoutine,
59
68
  onRoutineEnabledChange,
60
69
  onRunRoutine,
61
70
  onRunSelect,