@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
@@ -0,0 +1,80 @@
1
+ import { THEME_STORAGE_KEY, applyThemePreference, readThemePreference, resolveThemePreference, writeThemePreference } from "../utils/theme.js";
2
+ import * as React from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/components/ThemeProvider.tsx
5
+ const ThemeContext = React.createContext(null);
6
+ const useClientLayoutEffect = typeof document === "undefined" ? React.useEffect : React.useLayoutEffect;
7
+ /**
8
+ * Owns the application-wide theme preference and keeps document metadata,
9
+ * storage, cross-tab changes, and operating-system changes synchronized.
10
+ *
11
+ * Add `<meta name="color-scheme" content="light dark">` before styles and use
12
+ * `getThemeInitializationScript()` in the document head to avoid a flash when
13
+ * a saved override differs from the operating-system preference.
14
+ */
15
+ function ThemeProvider({ children, value, defaultValue = "system", onValueChange, storageKey = THEME_STORAGE_KEY }) {
16
+ const controlled = value !== void 0;
17
+ const [uncontrolledPreference, setUncontrolledPreference] = React.useState(defaultValue);
18
+ const preference = value ?? uncontrolledPreference;
19
+ const [resolvedTheme, setResolvedTheme] = React.useState(() => typeof window === "undefined" ? "light" : resolveThemePreference(preference));
20
+ const initialized = React.useRef(false);
21
+ useClientLayoutEffect(() => {
22
+ let initialPreference = preference;
23
+ if (!controlled && storageKey !== null) {
24
+ const storedPreference = readThemePreference(storageKey);
25
+ if (storedPreference !== "system" || defaultValue === "system") {
26
+ initialPreference = storedPreference;
27
+ setUncontrolledPreference(storedPreference);
28
+ }
29
+ }
30
+ setResolvedTheme(applyThemePreference(initialPreference));
31
+ initialized.current = true;
32
+ }, []);
33
+ React.useEffect(() => {
34
+ if (!initialized.current) return;
35
+ setResolvedTheme(applyThemePreference(preference));
36
+ if (storageKey !== null) writeThemePreference(preference, storageKey);
37
+ }, [preference, storageKey]);
38
+ React.useEffect(() => {
39
+ if (preference !== "system") return;
40
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
41
+ const handleChange = () => setResolvedTheme(mediaQuery.matches ? "dark" : "light");
42
+ mediaQuery.addEventListener("change", handleChange);
43
+ return () => mediaQuery.removeEventListener("change", handleChange);
44
+ }, [preference]);
45
+ React.useEffect(() => {
46
+ if (controlled || storageKey === null) return;
47
+ const handleStorage = (event) => {
48
+ if (event.key !== storageKey) return;
49
+ const nextPreference = readThemePreference(storageKey);
50
+ setUncontrolledPreference(nextPreference);
51
+ };
52
+ window.addEventListener("storage", handleStorage);
53
+ return () => window.removeEventListener("storage", handleStorage);
54
+ }, [controlled, storageKey]);
55
+ const setPreference = React.useCallback((nextPreference) => {
56
+ applyThemePreference(nextPreference);
57
+ if (!controlled) setUncontrolledPreference(nextPreference);
58
+ onValueChange?.(nextPreference);
59
+ }, [controlled, onValueChange]);
60
+ const contextValue = React.useMemo(() => ({
61
+ preference,
62
+ resolvedTheme,
63
+ setPreference
64
+ }), [
65
+ preference,
66
+ resolvedTheme,
67
+ setPreference
68
+ ]);
69
+ return /* @__PURE__ */ jsx(ThemeContext.Provider, {
70
+ value: contextValue,
71
+ children
72
+ });
73
+ }
74
+ function useTheme() {
75
+ const context = React.useContext(ThemeContext);
76
+ if (!context) throw new Error("useTheme must be used within a ThemeProvider");
77
+ return context;
78
+ }
79
+ //#endregion
80
+ export { ThemeProvider, useTheme };
@@ -1,10 +1,13 @@
1
- import { a as AgentChatRenderPartContext, r as AgentChatProps } from "../AgentChat-Cgb1xuT7.js";
1
+ import { i as AgentChatProps, o as AgentChatRenderPartContext } from "../AgentChat-CrlpbvQJ.js";
2
2
  import { n as BrowserLiveViewProps, t as BrowserLiveView } from "../BrowserLiveView-BV5qgFgI.js";
3
3
  import { n as BrowserReplayProps, t as BrowserReplay } from "../BrowserReplay-xWvRjRAC.js";
4
- import { _ as isThinkChatActivityPart } from "../ThinkChatToolParts-Cv4o7j6F.js";
5
- import { a as ThinkChatToolRenderers, c as renderThinkChatActivityPart, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as describeThinkChatActivityPart, t as ThinkChatActivity } from "../ThinkChatActivity-m9orbdeI.js";
4
+ import { S as isThinkChatActivityPart } from "../ThinkChatToolParts-CSzVwMXf.js";
5
+ import { l as describeThinkChatActivityPart } from "../ThinkChatActivitySummary-BPmu9a-c.js";
6
+ import { a as ThinkChatToolRenderers, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as renderThinkChatActivityPart, t as ThinkChatActivity } from "../ThinkChatActivity-BFQnb2ct.js";
6
7
  import { n as ThinkChatValue } from "../ThinkChatContext-C3Eb1Xpi.js";
7
- import { FileInfo, UseWorkspaceOptions, WorkspaceExplorer, WorkspaceExplorerProps, WorkspaceFileState, WorkspaceInfo, WorkspaceSource, WorkspaceState, inferWorkspaceLanguage, useWorkspace } from "./WorkspaceExplorer.js";
8
+ import { d as inferWorkspaceLanguage, i as WorkspaceFileState } from "../WorkspaceFile-DOZkPwzu.js";
9
+ import { a as useWorkspace, i as WorkspaceState, n as WorkspaceInfo, r as WorkspaceSource, t as UseWorkspaceOptions } from "../Workspace-D39LxGvP.js";
10
+ import { WorkspaceExplorer, WorkspaceExplorerProps } from "./WorkspaceExplorer.js";
8
11
  import * as React from "react";
9
12
  import { UIMessage } from "ai";
10
13
  import { UseAgentOptions } from "agents/react";
@@ -29,10 +32,26 @@ interface ThinkChatMessagesProps<MessageT extends UIMessage = UIMessage> extends
29
32
  className?: string;
30
33
  /** Disable the composer (e.g. while the agent is unreachable). */
31
34
  disabled?: boolean;
35
+ /** Hide the composer while retaining the normal Think transcript rendering. */
36
+ showComposer?: AgentChatProps<MessageT>["showComposer"];
32
37
  /** Shown in place of the list while there are no messages. */
33
38
  emptyState?: React.ReactNode;
34
39
  /** Extra controls rendered inside the composer, next to the send button. */
35
40
  composerTools?: React.ReactNode;
41
+ /** Keep submitting composed follow-ups through `chat.sendMessage()` while busy. */
42
+ allowSubmitWhileBusy?: AgentChatProps<MessageT>["allowSubmitWhileBusy"];
43
+ /** Authoritative queued messages rendered outside the transcript. */
44
+ queuedMessages?: AgentChatProps<MessageT>["queuedMessages"];
45
+ onSteerQueuedMessage?: AgentChatProps<MessageT>["onSteerQueuedMessage"];
46
+ onRemoveQueuedMessage?: AgentChatProps<MessageT>["onRemoveQueuedMessage"];
47
+ /** Host-owned slash-command catalog and selection policy. */
48
+ slashCommands?: AgentChatProps<MessageT>["slashCommands"];
49
+ /** Controlled MCP catalog revealed by `@`; selections become composer references. */
50
+ mentionCommands?: AgentChatProps<MessageT>["mentionCommands"];
51
+ /** Controlled folder or working-context picker in the composer footer. */
52
+ contextSelector?: AgentChatProps<MessageT>["contextSelector"];
53
+ /** Extra controls rendered at the trailing edge, before dictation and submit. */
54
+ composerEndTools?: React.ReactNode;
36
55
  /** Whole upstream `useVoiceInput` result for the built-in microphone recorder. */
37
56
  voiceInput?: UseVoiceInputReturn;
38
57
  /** Host prerequisite run before the built-in recorder calls `voiceInput.start()`. */
@@ -55,10 +74,16 @@ interface ThinkChatMessagesProps<MessageT extends UIMessage = UIMessage> extends
55
74
  * `isRecovering`/`connectionError`) shown between transcript and composer.
56
75
  */
57
76
  notice?: AgentChatProps<MessageT>["notice"];
58
- /** Full replacement for part rendering; wins over excludeTools/toolRenderers. */
77
+ /**
78
+ * Extends the built-in Think activity renderer. Returning `undefined` keeps
79
+ * the built-in result; `defaultRender()` renders that same result on demand.
80
+ * Return `null` only when the part should be intentionally hidden.
81
+ */
59
82
  renderPart?: AgentChatProps<MessageT>["renderPart"];
60
83
  /** Whole upstream Think stub. `ThinkChat.Root` wires `agent.stub` automatically. */
61
84
  thinkStub?: AgentStub<Think>;
85
+ /** Parent-owned Ask/Bypass policy; omit to keep AgentChat's session-local mode. */
86
+ permissionModeControl?: AgentChatProps<MessageT>["permissionModeControl"];
62
87
  /** Called after a Think approve/reject RPC settles. Root uses this to refresh approvals. */
63
88
  onExecutionSettled?: AgentChatProps<MessageT>["onExecutionSettled"];
64
89
  /** Think durable-pause approvals from `pendingApprovals()`. */
@@ -104,7 +129,9 @@ declare function ThinkChatRoot<State = unknown, MessageT extends UIMessage = UIM
104
129
  * The full conversation surface — message list plus composer — with the
105
130
  * activity renderer as the default `renderPart`: runs of reasoning/tool parts
106
131
  * fold into one collapsed Activity block with derived labels and per-tool
107
- * panels. Extend for app-specific tools with `toolRenderers` (label/panel
132
+ * panels. Session-generated context/load/search tools are recognized from
133
+ * their upstream runtime schemas and keep their recorded inputs and outputs
134
+ * inspectable. Extend for app-specific tools with `toolRenderers` (label/panel
108
135
  * inside the log) or `excludeTools` + your own `renderPart` (standalone
109
136
  * card) — see README "App-specific tools" and the Custom Tool Panel story.
110
137
  */
@@ -157,4 +184,4 @@ declare const ThinkChat: {
157
184
  createActivityRenderer: typeof createThinkChatActivityRenderer;
158
185
  };
159
186
  //#endregion
160
- export { BrowserLiveView, type BrowserLiveViewProps, BrowserReplay, type BrowserReplayProps, type FileInfo, ThinkChat, ThinkChatActivity, type ThinkChatActivityProps, type ThinkChatActivityRendererOptions, ThinkChatMessages, ThinkChatMessagesProps, ThinkChatProvider, ThinkChatProviderProps, ThinkChatRoot, ThinkChatRootProps, type ThinkChatToolRenderer, type ThinkChatToolRenderers, type UseWorkspaceOptions, WorkspaceExplorer, type WorkspaceExplorerProps, type WorkspaceFileState, type WorkspaceInfo, type WorkspaceSource, type WorkspaceState, createThinkChatActivityRenderer, describeThinkChatActivityPart, inferWorkspaceLanguage, isThinkChatActivityPart, renderThinkChatActivityPart, useThinkChat, useThinkPendingApprovals, useWorkspace };
187
+ export { BrowserLiveView, type BrowserLiveViewProps, BrowserReplay, type BrowserReplayProps, ThinkChat, ThinkChatActivity, type ThinkChatActivityProps, type ThinkChatActivityRendererOptions, ThinkChatMessages, ThinkChatMessagesProps, ThinkChatProvider, ThinkChatProviderProps, ThinkChatRoot, ThinkChatRootProps, type ThinkChatToolRenderer, type ThinkChatToolRenderers, type UseWorkspaceOptions, WorkspaceExplorer, type WorkspaceExplorerProps, type WorkspaceFileState, type WorkspaceInfo, type WorkspaceSource, type WorkspaceState, createThinkChatActivityRenderer, describeThinkChatActivityPart, inferWorkspaceLanguage, isThinkChatActivityPart, renderThinkChatActivityPart, useThinkChat, useThinkPendingApprovals, useWorkspace };
@@ -1,7 +1,10 @@
1
+ import { isThinkChatActivityPart } from "./ThinkChatToolParts.js";
1
2
  import { BrowserLiveView } from "./BrowserLiveView.js";
2
3
  import { BrowserReplay } from "./BrowserReplay.js";
3
- import { isThinkChatActivityPart } from "./ThinkChatToolParts.js";
4
- import { ThinkChatActivity, createThinkChatActivityRenderer, describeThinkChatActivityPart, renderThinkChatActivityPart } from "./ThinkChatActivity.js";
5
- import { a as useThinkChat, i as ThinkChatRoot, n as ThinkChatMessages, o as useThinkPendingApprovals, r as ThinkChatProvider, t as ThinkChat } from "../ThinkChat-7DQ2CogF.js";
6
- import { WorkspaceExplorer, inferWorkspaceLanguage, useWorkspace } from "./WorkspaceExplorer.js";
4
+ import { describeThinkChatActivityPart } from "./ThinkChatActivitySummary.js";
5
+ import { ThinkChatActivity, createThinkChatActivityRenderer, renderThinkChatActivityPart } from "./ThinkChatActivity.js";
6
+ import { a as useThinkChat, i as ThinkChatRoot, n as ThinkChatMessages, o as useThinkPendingApprovals, r as ThinkChatProvider, t as ThinkChat } from "../ThinkChat-CzC-zNGA.js";
7
+ import { inferWorkspaceLanguage } from "./WorkspaceFile.js";
8
+ import { useWorkspace } from "./Workspace.js";
9
+ import { WorkspaceExplorer } from "./WorkspaceExplorer.js";
7
10
  export { BrowserLiveView, BrowserReplay, ThinkChat, ThinkChatActivity, ThinkChatMessages, ThinkChatProvider, ThinkChatRoot, WorkspaceExplorer, createThinkChatActivityRenderer, describeThinkChatActivityPart, inferWorkspaceLanguage, isThinkChatActivityPart, renderThinkChatActivityPart, useThinkChat, useThinkPendingApprovals, useWorkspace };
@@ -1,3 +1,4 @@
1
- import { _ as isThinkChatActivityPart } from "../ThinkChatToolParts-Cv4o7j6F.js";
2
- import { a as ThinkChatToolRenderers, c as renderThinkChatActivityPart, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as describeThinkChatActivityPart, t as ThinkChatActivity } from "../ThinkChatActivity-m9orbdeI.js";
1
+ import { S as isThinkChatActivityPart } from "../ThinkChatToolParts-CSzVwMXf.js";
2
+ import { l as describeThinkChatActivityPart } from "../ThinkChatActivitySummary-BPmu9a-c.js";
3
+ import { a as ThinkChatToolRenderers, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as renderThinkChatActivityPart, t as ThinkChatActivity } from "../ThinkChatActivity-BFQnb2ct.js";
3
4
  export { ThinkChatActivity, ThinkChatActivityProps, ThinkChatActivityRendererOptions, ThinkChatToolRenderer, ThinkChatToolRenderers, createThinkChatActivityRenderer, describeThinkChatActivityPart, isThinkChatActivityPart, renderThinkChatActivityPart };
@@ -1,303 +1,16 @@
1
- import { D as PencilIcon, I as TerminalIcon, L as WarningIcon, R as WrenchIcon, b as LinkIcon, h as FileIcon, j as SearchIcon, w as MonitorIcon, y as InfoIcon } from "../icons-Ba9THQKz.js";
2
1
  import { Activity, ActivityContent, ActivityItem, ActivityItemGroup, ActivityText, ActivityTrigger } from "./Activity.js";
3
- import { t as summarizeToolInput } from "../summarize-tool-input-BUJsENSn.js";
2
+ import { AgentActivityFavicon, AgentActivityIcon } from "./AgentActivity.js";
3
+ import { isBrowserToolPart, isExecuteToolPart, isFetchToolPart, isPartWorking, isSessionContextToolPart, isSkillToolPart, isThinkChatActivityPart, isWorkspaceToolPart } from "./ThinkChatToolParts.js";
4
4
  import { useOptionalThinkChatContext } from "./ThinkChatContext.js";
5
- import { displayUrl, isBrowserToolPart, isExecuteToolPart, isFetchToolPart, isPartFailed, isPartWorking, isSkillToolPart, isThinkChatActivityPart, isWorkspaceToolPart } from "./ThinkChatToolParts.js";
6
- import { ThinkChatBrowserPanel, ThinkChatExecutePanel, ThinkChatFetchPanel, ThinkChatSkillPanel, ThinkChatWorkspacePanel } from "./ThinkChatToolPanels.js";
7
- import * as React from "react";
5
+ import { ThinkChatBrowserPanel, ThinkChatExecutePanel, ThinkChatFetchPanel, ThinkChatSessionContextPanel, ThinkChatSkillPanel, ThinkChatWorkspacePanel } from "./ThinkChatToolPanels.js";
6
+ import { activityPartIconKind, activityPartUrl, deriveThinkChatActivityHeader, describeThinkChatActivityPart } from "./ThinkChatActivitySummary.js";
7
+ import "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
- import { getToolInput, getToolOutput } from "@cloudflare/think/react";
10
9
  import { getToolName, isReasoningUIPart, isToolUIPart } from "ai";
11
10
  //#region src/components/ThinkChatActivity.tsx
12
- const HTTP_URL_PATTERN = /https?:\/\/[^\s"'<>)}\]]+/i;
13
- function firstHttpUrl(value) {
14
- const text = typeof value === "string" ? value : JSON.stringify(value) ?? "";
15
- const raw = HTTP_URL_PATTERN.exec(text)?.[0]?.replace(/[.,;:!?]+$/, "");
16
- if (!raw) return null;
17
- try {
18
- return new URL(raw).href;
19
- } catch {
20
- return null;
21
- }
22
- }
23
- function ActivityFavicon({ url }) {
24
- const src = faviconHref(url);
25
- const [failed, setFailed] = React.useState(false);
26
- React.useEffect(() => setFailed(false), [src]);
27
- if (!src || failed) return /* @__PURE__ */ jsx(LinkIcon, {});
28
- return /* @__PURE__ */ jsx("img", {
29
- className: "activity__favicon",
30
- src,
31
- alt: "",
32
- loading: "lazy",
33
- decoding: "async",
34
- onError: () => setFailed(true)
35
- });
36
- }
37
- function faviconHref(url) {
38
- try {
39
- return new URL("/favicon.ico", url).href;
40
- } catch {
41
- return null;
42
- }
43
- }
44
- function ActivityKindIcon({ kind }) {
45
- switch (kind) {
46
- case "thought": return /* @__PURE__ */ jsx(InfoIcon, {});
47
- case "read": return /* @__PURE__ */ jsx(FileIcon, {});
48
- case "edit": return /* @__PURE__ */ jsx(PencilIcon, {});
49
- case "search": return /* @__PURE__ */ jsx(SearchIcon, {});
50
- case "web": return /* @__PURE__ */ jsx(LinkIcon, {});
51
- case "command": return /* @__PURE__ */ jsx(TerminalIcon, {});
52
- case "browser": return /* @__PURE__ */ jsx(MonitorIcon, {});
53
- case "tool": return /* @__PURE__ */ jsx(WrenchIcon, {});
54
- }
55
- }
56
- function genericToolLabels(name, hasUrl) {
57
- const normalized = name.toLowerCase();
58
- if (normalized.includes("grep") || normalized.includes("find") || normalized.includes("code")) return {
59
- working: "Searching code",
60
- done: "Searched code",
61
- failed: "Code search failed",
62
- summary: "searched code",
63
- icon: "search"
64
- };
65
- if (normalized.includes("search") || normalized.includes("web") || normalized.includes("browser") || normalized.includes("google")) return {
66
- working: "Searching the web",
67
- done: "Searched the web",
68
- failed: "Web search failed",
69
- summary: "searched the web",
70
- icon: "web"
71
- };
72
- if (hasUrl || normalized.includes("fetch") || normalized.includes("http") || normalized.includes("url")) return {
73
- working: "Reading a URL",
74
- done: "Read a URL",
75
- failed: "URL read failed",
76
- summary: "read a URL",
77
- icon: "web"
78
- };
79
- if (normalized.includes("edit") || normalized.includes("write") || normalized.includes("delete") || normalized.includes("patch") || normalized.includes("apply") || normalized.includes("create") || normalized.includes("update")) return {
80
- working: "Editing files",
81
- done: "Edited files",
82
- failed: "Edit failed",
83
- summary: "edited files",
84
- icon: "edit"
85
- };
86
- if (normalized.includes("exec") || normalized.includes("bash") || normalized.includes("shell") || normalized.includes("terminal") || normalized.includes("command")) return {
87
- working: "Running a command",
88
- done: "Ran a command",
89
- failed: "Command failed",
90
- summary: "ran a command",
91
- icon: "command"
92
- };
93
- if (normalized.includes("read") || normalized.includes("open") || normalized.includes("list") || normalized.includes("file")) return {
94
- working: "Reading files",
95
- done: "Read files",
96
- failed: "Read failed",
97
- summary: "read files",
98
- icon: "read"
99
- };
100
- return {
101
- working: "Using a tool",
102
- done: "Used a tool",
103
- failed: "Tool failed",
104
- summary: "used a tool",
105
- icon: "tool"
106
- };
107
- }
108
- function describeGenericToolPart(part) {
109
- const labels = genericToolLabels(getToolName(part), activityPartUrl(part) !== null);
110
- const label = isPartFailed(part) ? labels.failed : isPartWorking(part) ? labels.working : labels.done;
111
- const detail = summarizeToolInput(getToolInput(part));
112
- return detail ? `${label} · ${detail}` : label;
113
- }
114
- function activityPartUrl(part) {
115
- if (isFetchToolPart(part)) return firstHttpUrl(part.input?.url ?? part.input?.path);
116
- if (isBrowserToolPart(part) && part.type !== "tool-browser_execute") return firstHttpUrl(part.input?.url);
117
- if (isToolUIPart(part) && !isExecuteToolPart(part)) return firstHttpUrl(getToolInput(part)) ?? (part.state === "output-available" ? firstHttpUrl(getToolOutput(part)) : null);
118
- return null;
119
- }
120
- function activityPartIconKind(part) {
121
- if (isReasoningUIPart(part)) return "thought";
122
- if (isWorkspaceToolPart(part)) switch (part.type) {
123
- case "tool-read":
124
- case "tool-list": return "read";
125
- case "tool-write":
126
- case "tool-edit":
127
- case "tool-delete": return "edit";
128
- case "tool-find":
129
- case "tool-grep": return "search";
130
- case "tool-bash": return "command";
131
- }
132
- if (isSkillToolPart(part)) return "tool";
133
- if (isFetchToolPart(part)) return "web";
134
- if (isBrowserToolPart(part)) return part.type === "tool-browser_execute" ? "browser" : "web";
135
- if (isExecuteToolPart(part)) return "command";
136
- if (isToolUIPart(part)) return genericToolLabels(getToolName(part), activityPartUrl(part) !== null).icon;
137
- return "tool";
138
- }
139
11
  function activityPartIcon(part) {
140
12
  const url = activityPartUrl(part);
141
- return url ? /* @__PURE__ */ jsx(ActivityFavicon, { url }) : /* @__PURE__ */ jsx(ActivityKindIcon, { kind: activityPartIconKind(part) });
142
- }
143
- function activitySummaryIcon(parts) {
144
- if (parts.find((part) => isToolUIPart(part) && isPartFailed(part))) return /* @__PURE__ */ jsx(WarningIcon, {});
145
- const representative = parts.find((part) => activityPartIconKind(part) === "edit") ?? parts.find((part) => activityPartUrl(part)) ?? parts.find((part) => describeThinkChatActivityPart(part));
146
- return representative ? activityPartIcon(representative) : /* @__PURE__ */ jsx(ActivityKindIcon, { kind: "tool" });
147
- }
148
- /**
149
- * One-line natural-language label for an activity part ("Ran vp test",
150
- * "Fetched developers.cloudflare.com/agents/"); `null` for boundaries that
151
- * aren't steps (step-start). Exported so a custom `renderPart` can reuse the
152
- * built-in labels for tools it doesn't override.
153
- */
154
- function describeThinkChatActivityPart(part, toolRenderers) {
155
- if (isToolUIPart(part)) {
156
- const custom = toolRenderers?.[getToolName(part)]?.describe?.(part);
157
- if (custom !== void 0) return custom;
158
- }
159
- if (isReasoningUIPart(part)) {
160
- const snippet = summarizeToolInput({ text: part.text });
161
- const label = part.state === "streaming" ? "Thinking…" : "Thought";
162
- return snippet ? `${label} · ${snippet}` : label;
163
- }
164
- if (isWorkspaceToolPart(part)) return describeWorkspaceToolPart(part);
165
- if (isSkillToolPart(part)) return describeSkillToolPart(part);
166
- if (isFetchToolPart(part)) return describeFetchToolPart(part);
167
- if (isBrowserToolPart(part)) return describeBrowserToolPart(part);
168
- if (isExecuteToolPart(part)) return describeExecuteToolPart(part);
169
- if (isToolUIPart(part)) return describeGenericToolPart(part);
170
- return null;
171
- }
172
- function basename(path) {
173
- return path?.split("/").filter(Boolean).at(-1) ?? null;
174
- }
175
- function describeWorkspaceToolPart(part) {
176
- const working = isPartWorking(part);
177
- const failed = isPartFailed(part);
178
- if (part.type === "tool-bash") {
179
- const command = part.input?.script?.trim() ?? "";
180
- if (failed) return command ? `Command failed · ${command}` : "Command failed";
181
- const verb = working ? "Running" : "Ran";
182
- return command ? `${verb} ${command}` : `${verb} a command`;
183
- }
184
- const label = (() => {
185
- switch (part.type) {
186
- case "tool-read": return `${working ? "Reading" : "Read"} ${basename(part.input?.path) ?? "a file"}`;
187
- case "tool-write": return `${working ? "Writing" : "Wrote"} ${basename(part.input?.path) ?? "a file"}`;
188
- case "tool-edit": return `${working ? "Editing" : "Edited"} ${basename(part.input?.path) ?? "a file"}`;
189
- case "tool-delete": return `${working ? "Deleting" : "Deleted"} ${part.input?.path || "a file"}`;
190
- case "tool-list": {
191
- const path = part.input?.path;
192
- return `${working ? "Listing" : "Listed"} ${path && path !== "/" ? path : "files"}`;
193
- }
194
- case "tool-find": return `${working ? "Searching" : "Searched"} for ${part.input?.pattern || "files"}`;
195
- case "tool-grep": return `${working ? "Searching" : "Searched"} for ${part.input?.query || "text"}`;
196
- }
197
- })();
198
- return failed ? `${label} · failed` : label;
199
- }
200
- function describeSkillToolPart(part) {
201
- const working = isPartWorking(part);
202
- const failed = isPartFailed(part);
203
- const label = (() => {
204
- switch (part.type) {
205
- case "tool-activate_skill": {
206
- const name = part.input?.name;
207
- return `${working ? "Using" : "Used"} ${name ? `the ${name} skill` : "a skill"}`;
208
- }
209
- case "tool-read_skill_resource": return `${working ? "Reading" : "Read"} ${part.input?.path ?? "a skill resource"}`;
210
- case "tool-run_skill_script": return `${working ? "Running" : "Ran"} ${part.input?.path ?? "a skill script"}`;
211
- }
212
- })();
213
- return failed ? `${label} · failed` : label;
214
- }
215
- function describeBrowserToolPart(part) {
216
- const working = isPartWorking(part);
217
- const failed = isPartFailed(part);
218
- if (part.type === "tool-browser_execute") {
219
- const output = part.state === "output-available" ? part.output : void 0;
220
- if (failed || output?.status === "error") return "Browser automation failed";
221
- if (output?.status === "paused") return "Browser waiting for approval";
222
- return working ? "Using the browser" : "Used the browser";
223
- }
224
- const page = displayUrl(part.input?.url) || "a page";
225
- const label = (() => {
226
- switch (part.type) {
227
- case "tool-browser_extract": return `${working ? "Extracting" : "Extracted"} data from ${page}`;
228
- case "tool-browser_links": return `${working ? "Listing" : "Listed"} links on ${page}`;
229
- case "tool-browser_scrape": return `${working ? "Scraping" : "Scraped"} ${page}`;
230
- default: return `${working ? "Browsing" : "Browsed"} ${page}`;
231
- }
232
- })();
233
- return failed ? `${label} · failed` : label;
234
- }
235
- function describeExecuteToolPart(part) {
236
- const output = part.state === "output-available" ? part.output : void 0;
237
- if (isPartFailed(part) || output?.status === "error") return "Code failed";
238
- if (output?.status === "paused") return "Code waiting for approval";
239
- const label = isPartWorking(part) ? "Running code" : "Ran code";
240
- const snippet = summarizeToolInput(part.input);
241
- return snippet ? `${label} · ${snippet}` : label;
242
- }
243
- function describeFetchToolPart(part) {
244
- const target = part.input?.url ?? part.input?.path ?? "";
245
- const output = part.state === "output-available" ? part.output : void 0;
246
- if (isPartFailed(part) || output?.ok === false) return target ? `Fetch failed · ${target}` : "Fetch failed";
247
- const verb = isPartWorking(part) ? "Fetching" : "Fetched";
248
- return target ? `${verb} ${target}` : `${verb} a URL`;
249
- }
250
- function summarizeActivitySteps(parts) {
251
- const byTool = /* @__PURE__ */ new Map();
252
- const genericSegments = /* @__PURE__ */ new Set();
253
- const skillNames = /* @__PURE__ */ new Set();
254
- let thoughts = 0;
255
- let skillParts = 0;
256
- let fetches = 0;
257
- let browses = 0;
258
- let codeRuns = 0;
259
- for (const part of parts) if (isReasoningUIPart(part)) thoughts++;
260
- else if (isWorkspaceToolPart(part)) {
261
- const name = getToolName(part);
262
- byTool.set(name, (byTool.get(name) ?? 0) + 1);
263
- } else if (isSkillToolPart(part)) {
264
- skillParts++;
265
- if (typeof part.input?.name === "string") skillNames.add(part.input.name);
266
- } else if (isFetchToolPart(part)) fetches++;
267
- else if (isBrowserToolPart(part)) browses++;
268
- else if (isExecuteToolPart(part)) codeRuns++;
269
- else if (isToolUIPart(part)) genericSegments.add(genericToolLabels(getToolName(part), activityPartUrl(part) !== null).summary);
270
- const count = (name) => byTool.get(name) ?? 0;
271
- const files = (n) => n === 1 ? "a file" : `${n} files`;
272
- const reads = count("read");
273
- const edits = count("edit") + count("write");
274
- const deletes = count("delete");
275
- const commands = count("bash");
276
- const segments = [];
277
- if (thoughts > 0) segments.push("thought");
278
- if (skillParts > 0) segments.push(skillNames.size === 1 ? `used the ${[...skillNames][0]} skill` : skillNames.size > 1 ? `used ${skillNames.size} skills` : "used a skill");
279
- if (reads > 0) segments.push(`read ${files(reads)}`);
280
- if (edits > 0) segments.push(`edited ${files(edits)}`);
281
- if (deletes > 0) segments.push(`deleted ${files(deletes)}`);
282
- if (count("find") + count("grep") > 0) segments.push("searched code");
283
- if (count("list") > 0) segments.push("listed files");
284
- if (fetches > 0) segments.push(fetches === 1 ? "fetched a URL" : `fetched ${fetches} URLs`);
285
- if (browses > 0) segments.push("used the browser");
286
- if (codeRuns > 0) segments.push("ran code");
287
- if (commands > 0) segments.push(commands === 1 ? "ran a command" : `ran ${commands} commands`);
288
- for (const segment of [
289
- "edited files",
290
- "searched code",
291
- "searched the web",
292
- "read a URL",
293
- "ran a command",
294
- "read files",
295
- "used a tool"
296
- ]) if (genericSegments.has(segment)) segments.push(segment);
297
- if (segments.length === 0) return "Worked";
298
- const top = segments.slice(0, 3);
299
- const joined = top.length === 1 ? top[0] : `${top.slice(0, -1).join(", ")} and ${top.at(-1)}`;
300
- return joined.charAt(0).toUpperCase() + joined.slice(1);
13
+ return url ? /* @__PURE__ */ jsx(AgentActivityFavicon, { url }) : /* @__PURE__ */ jsx(AgentActivityIcon, { kind: activityPartIconKind(part) });
301
14
  }
302
15
  /**
303
16
  * One run of agent work as a collapsed Activity block: while streaming the
@@ -318,14 +31,17 @@ function ThinkChatActivity({ parts, defaultOpen, isStreaming, toolRenderers }) {
318
31
  });
319
32
  if (steps.length === 0) return null;
320
33
  const streaming = isStreaming ?? parts.some(isPartWorking);
321
- const settledLabel = summarizeActivitySteps(parts);
322
- const latest = steps.at(-1);
34
+ const header = deriveThinkChatActivityHeader(parts, {
35
+ isStreaming: streaming,
36
+ toolDescribers: toolRenderers
37
+ });
38
+ if (!header) return null;
323
39
  return /* @__PURE__ */ jsxs(Activity, {
324
40
  isStreaming: streaming,
325
41
  defaultOpen,
326
42
  children: [/* @__PURE__ */ jsx(ActivityTrigger, {
327
- icon: streaming && latest ? activityPartIcon(latest.part) : activitySummaryIcon(parts),
328
- label: streaming && latest ? latest.text : settledLabel
43
+ icon: header.url ? /* @__PURE__ */ jsx(AgentActivityFavicon, { url: header.url }) : /* @__PURE__ */ jsx(AgentActivityIcon, { kind: header.iconKind }),
44
+ label: header.label
329
45
  }), /* @__PURE__ */ jsx(ActivityContent, { children: steps.map((step) => /* @__PURE__ */ jsx(ThinkChatActivityStep, {
330
46
  text: step.text,
331
47
  part: step.part,
@@ -362,6 +78,11 @@ function ThinkChatActivityStep({ text, part, toolRenderers }) {
362
78
  icon,
363
79
  children: /* @__PURE__ */ jsx(ThinkChatSkillPanel, { part })
364
80
  });
81
+ if (isSessionContextToolPart(part)) return /* @__PURE__ */ jsx(ActivityItemGroup, {
82
+ label: text,
83
+ icon,
84
+ children: /* @__PURE__ */ jsx(ThinkChatSessionContextPanel, { part })
85
+ });
365
86
  if (isFetchToolPart(part)) return /* @__PURE__ */ jsx(ActivityItemGroup, {
366
87
  label: text,
367
88
  icon,
@@ -0,0 +1,2 @@
1
+ import { a as activityPartIconKind, c as deriveThinkChatToolLifecycleHeader, i as ThinkChatToolLifecycleSnapshot, l as describeThinkChatActivityPart, n as ThinkChatToolDescriber, o as activityPartUrl, r as ThinkChatToolDescribers, s as deriveThinkChatActivityHeader, t as ThinkChatActivityHeader, u as summarizeActivitySteps } from "../ThinkChatActivitySummary-BPmu9a-c.js";
2
+ export { ThinkChatActivityHeader, ThinkChatToolDescriber, ThinkChatToolDescribers, ThinkChatToolLifecycleSnapshot, activityPartIconKind, activityPartUrl, deriveThinkChatActivityHeader, deriveThinkChatToolLifecycleHeader, describeThinkChatActivityPart, summarizeActivitySteps };