@mcp-b/react-components 0.14.2 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/dist/AgentActivity-BNUNrP9O.d.ts +36 -0
  2. package/dist/{AgentChat-DQkqt82e.d.ts → AgentChat-CrlpbvQJ.d.ts} +58 -6
  3. package/dist/{CodeBlock-DUh9WOGo.d.ts → CodeBlock-BRajW4QU.d.ts} +1 -1
  4. package/dist/{CodeBlock-BUFXG8HW.js → CodeBlock-BmB4Xaqq.js} +15 -4
  5. package/dist/{FileTree-mpEIcfzA.js → FileTree-CkVbIMWV.js} +82 -89
  6. package/dist/Message-BkMdE3bS.js +375 -0
  7. package/dist/{ModelSelector-CPCpFAUt.js → ModelSelector-SlJNgwKY.js} +2 -2
  8. package/dist/{PromptInput-ClNqBiIw.d.ts → PromptInput-BWTuXMOD.d.ts} +123 -5
  9. package/dist/ResponsiveSidebarShell-Dd9DCcBT.d.ts +67 -0
  10. package/dist/{Select-Dl_vF_Bt.d.ts → Select-BeEsefzh.d.ts} +12 -2
  11. package/dist/{ThinkChat-BPcehdbP.js → ThinkChat-CzC-zNGA.js} +24 -36
  12. package/dist/{ThinkChatActivity-BmwuIigx.d.ts → ThinkChatActivity-BFQnb2ct.d.ts} +3 -10
  13. package/dist/ThinkChatActivitySummary-BPmu9a-c.d.ts +39 -0
  14. package/dist/{ThinkChatToolParts-CDEjqS6A.d.ts → ThinkChatToolParts-CSzVwMXf.d.ts} +13 -3
  15. package/dist/ThinkExecutionRun-ChhWhOoU.d.ts +30 -0
  16. package/dist/Toggle-CAAlNl-M.d.ts +69 -0
  17. package/dist/ToggleGroup-8hPv-b69.d.ts +73 -0
  18. package/dist/Workspace-D39LxGvP.d.ts +62 -0
  19. package/dist/WorkspaceFile-DOZkPwzu.d.ts +106 -0
  20. package/dist/WorkspaceFileView-rSN_yT0L.js +744 -0
  21. package/dist/WorkspaceLink-DIPbXrUM.js +337 -0
  22. package/dist/WorkspaceLink-DK1DWMHe.d.ts +89 -0
  23. package/dist/components/Activity.d.ts +27 -1
  24. package/dist/components/Activity.js +33 -15
  25. package/dist/components/AgentActivity.d.ts +2 -0
  26. package/dist/components/AgentActivity.js +45 -0
  27. package/dist/components/AgentActivityPreview.d.ts +46 -0
  28. package/dist/components/AgentActivityPreview.js +94 -0
  29. package/dist/components/AgentAttention.d.ts +73 -0
  30. package/dist/components/AgentAttention.js +85 -0
  31. package/dist/components/AgentChat.d.ts +2 -2
  32. package/dist/components/AgentChat.js +224 -200
  33. package/dist/components/AgentChatMessageEditor.d.ts +29 -0
  34. package/dist/components/AgentChatMessageEditor.js +92 -0
  35. package/dist/components/AgentChatTurnError.d.ts +17 -0
  36. package/dist/components/AgentChatTurnError.js +40 -0
  37. package/dist/components/AgentConnection.d.ts +12 -17
  38. package/dist/components/AgentConnection.js +99 -91
  39. package/dist/components/AppFrame.d.ts +24 -0
  40. package/dist/components/AppFrame.js +25 -0
  41. package/dist/components/AppTopBar.d.ts +71 -0
  42. package/dist/components/AppTopBar.js +82 -0
  43. package/dist/components/Artifact.js +1 -1
  44. package/dist/components/BrowserLiveView.js +1 -1
  45. package/dist/components/BrowserReplay.js +1 -1
  46. package/dist/components/BrowserRunPanel.js +1 -1
  47. package/dist/components/Card.d.ts +3 -0
  48. package/dist/components/Card.js +2 -1
  49. package/dist/components/ChainOfThought.d.ts +1 -1
  50. package/dist/components/ChainOfThought.js +1 -1
  51. package/dist/components/ChatGptSignInScreen.js +2 -2
  52. package/dist/components/Checkbox.js +5 -13
  53. package/dist/components/CheckboxGroup.d.ts +58 -2
  54. package/dist/components/CheckboxGroup.js +59 -1
  55. package/dist/components/CodeBlock.d.ts +1 -1
  56. package/dist/components/CodeBlock.js +1 -1
  57. package/dist/components/CodexModelSelector.js +1 -1
  58. package/dist/components/Commit.js +2 -2
  59. package/dist/components/ContextMenu.js +1 -1
  60. package/dist/components/Conversation.js +1 -1
  61. package/dist/components/DescriptionList.d.ts +12 -0
  62. package/dist/components/DescriptionList.js +11 -0
  63. package/dist/components/DescriptionListParts.d.ts +37 -0
  64. package/dist/components/DescriptionListParts.js +35 -0
  65. package/dist/components/EnvironmentVariables.js +2 -2
  66. package/dist/components/Fieldset.d.ts +13 -1
  67. package/dist/components/Fieldset.js +11 -2
  68. package/dist/components/FileTree.js +1 -1
  69. package/dist/components/IconButton.d.ts +33 -0
  70. package/dist/components/IconButton.js +27 -0
  71. package/dist/components/McpConnectionRequest.d.ts +44 -0
  72. package/dist/components/McpConnectionRequest.js +122 -0
  73. package/dist/components/McpServerPicker.d.ts +48 -23
  74. package/dist/components/McpServerPicker.js +238 -189
  75. package/dist/components/Menubar.js +1 -1
  76. package/dist/components/Message.d.ts +1 -0
  77. package/dist/components/Message.js +1 -285
  78. package/dist/components/MessageScroller.js +1 -1
  79. package/dist/components/ModelSelector.js +1 -1
  80. package/dist/components/Pricing.d.ts +37 -0
  81. package/dist/components/Pricing.js +17 -0
  82. package/dist/components/PricingBillingToggle.d.ts +23 -0
  83. package/dist/components/PricingBillingToggle.js +86 -0
  84. package/dist/components/PricingConfirmationDialog.d.ts +25 -0
  85. package/dist/components/PricingConfirmationDialog.js +57 -0
  86. package/dist/components/PricingFAQ.d.ts +18 -0
  87. package/dist/components/PricingFAQ.js +27 -0
  88. package/dist/components/PricingPage.d.ts +2 -38
  89. package/dist/components/PricingPage.js +39 -359
  90. package/dist/components/PricingPlanCard.d.ts +22 -0
  91. package/dist/components/PricingPlanCard.js +109 -0
  92. package/dist/components/PricingUsageCalculator.d.ts +22 -0
  93. package/dist/components/PricingUsageCalculator.js +96 -0
  94. package/dist/components/PromptInput.d.ts +2 -2
  95. package/dist/components/PromptInput.js +210 -15
  96. package/dist/components/Queue.js +1 -1
  97. package/dist/components/Reasoning.d.ts +2 -1
  98. package/dist/components/Reasoning.js +14 -29
  99. package/dist/components/ResizableSidePanel.d.ts +57 -0
  100. package/dist/components/ResizableSidePanel.js +151 -0
  101. package/dist/components/ResponsiveSidebarShell.d.ts +2 -0
  102. package/dist/components/ResponsiveSidebarShell.js +129 -0
  103. package/dist/components/Select.d.ts +2 -2
  104. package/dist/components/Select.js +11 -2
  105. package/dist/components/Slider.d.ts +13 -1
  106. package/dist/components/Slider.js +11 -0
  107. package/dist/components/Sources.js +1 -1
  108. package/dist/components/Stepper.d.ts +4 -0
  109. package/dist/components/Stepper.js +5 -3
  110. package/dist/components/SubagentRun.d.ts +18 -19
  111. package/dist/components/SubagentRun.js +25 -18
  112. package/dist/components/SubagentRunIndicator.d.ts +22 -0
  113. package/dist/components/SubagentRunIndicator.js +33 -0
  114. package/dist/components/SubagentRunList.d.ts +25 -0
  115. package/dist/components/SubagentRunList.js +26 -0
  116. package/dist/components/SubagentRunSelector.d.ts +47 -0
  117. package/dist/components/SubagentRunSelector.js +55 -0
  118. package/dist/components/Task.js +1 -1
  119. package/dist/components/Terminal.js +2 -2
  120. package/dist/components/TestResults.js +1 -1
  121. package/dist/components/Textarea.d.ts +21 -0
  122. package/dist/components/Textarea.js +19 -0
  123. package/dist/components/ThemeModeControl.d.ts +24 -0
  124. package/dist/components/ThemeModeControl.js +52 -0
  125. package/dist/components/ThemeProvider.d.ts +38 -0
  126. package/dist/components/ThemeProvider.js +80 -0
  127. package/dist/components/ThinkChat.d.ts +29 -6
  128. package/dist/components/ThinkChat.js +7 -4
  129. package/dist/components/ThinkChatActivity.d.ts +3 -2
  130. package/dist/components/ThinkChatActivity.js +12 -318
  131. package/dist/components/ThinkChatActivitySummary.d.ts +2 -0
  132. package/dist/components/ThinkChatActivitySummary.js +421 -0
  133. package/dist/components/ThinkChatToolPanels.d.ts +7 -5
  134. package/dist/components/ThinkChatToolPanels.js +70 -8
  135. package/dist/components/ThinkChatToolParts.d.ts +2 -2
  136. package/dist/components/ThinkChatToolParts.js +36 -10
  137. package/dist/components/ThinkExecutionDetail.d.ts +20 -0
  138. package/dist/components/ThinkExecutionDetail.js +80 -0
  139. package/dist/components/ThinkExecutionRun.d.ts +2 -0
  140. package/dist/components/ThinkExecutionRun.js +72 -0
  141. package/dist/components/ThinkExecutionStatus.d.ts +22 -0
  142. package/dist/components/ThinkExecutionStatus.js +36 -0
  143. package/dist/components/ThinkExecutionWorkbench.d.ts +7 -0
  144. package/dist/components/ThinkExecutionWorkbench.js +69 -225
  145. package/dist/components/ThinkFullApp.d.ts +58 -14
  146. package/dist/components/ThinkFullApp.js +129 -160
  147. package/dist/components/ThinkFullAppViewSwitch.d.ts +31 -0
  148. package/dist/components/ThinkFullAppViewSwitch.js +34 -0
  149. package/dist/components/ThinkRoutine.d.ts +36 -0
  150. package/dist/components/ThinkRoutine.js +15 -0
  151. package/dist/components/ThinkRoutineBrowser.d.ts +25 -0
  152. package/dist/components/ThinkRoutineBrowser.js +156 -0
  153. package/dist/components/ThinkRoutineDetail.d.ts +24 -0
  154. package/dist/components/ThinkRoutineDetail.js +102 -0
  155. package/dist/components/ThinkRoutineForm.d.ts +32 -0
  156. package/dist/components/ThinkRoutineForm.js +151 -0
  157. package/dist/components/ThinkRoutineLibrary.d.ts +74 -0
  158. package/dist/components/ThinkRoutineLibrary.js +178 -0
  159. package/dist/components/ThinkRoutineRuns.d.ts +24 -0
  160. package/dist/components/ThinkRoutineRuns.js +68 -0
  161. package/dist/components/ThinkThreadPicker.d.ts +18 -1
  162. package/dist/components/ThinkThreadPicker.js +51 -5
  163. package/dist/components/ThinkThreadShell.d.ts +12 -9
  164. package/dist/components/ThinkThreadShell.js +17 -137
  165. package/dist/components/Toggle.d.ts +1 -68
  166. package/dist/components/ToggleGroup.d.ts +1 -72
  167. package/dist/components/Tooltip.d.ts +3 -1
  168. package/dist/components/Tooltip.js +4 -2
  169. package/dist/components/WebPreview.js +1 -1
  170. package/dist/components/Workspace.d.ts +2 -0
  171. package/dist/components/Workspace.js +424 -0
  172. package/dist/components/WorkspaceBrowser.d.ts +32 -0
  173. package/dist/components/WorkspaceBrowser.js +103 -0
  174. package/dist/components/WorkspaceExplorer.d.ts +12 -79
  175. package/dist/components/WorkspaceExplorer.js +116 -330
  176. package/dist/components/WorkspaceFile.d.ts +2 -0
  177. package/dist/components/WorkspaceFile.js +195 -0
  178. package/dist/components/WorkspaceFileView.d.ts +26 -0
  179. package/dist/components/WorkspaceFileView.js +2 -0
  180. package/dist/components/WorkspaceHeader.d.ts +35 -0
  181. package/dist/components/WorkspaceHeader.js +51 -0
  182. package/dist/components/WorkspaceLink.d.ts +2 -0
  183. package/dist/components/WorkspaceLink.js +2 -0
  184. package/dist/components/icons.d.ts +2 -2
  185. package/dist/components/icons.js +2 -2
  186. package/dist/{copy-button-DUMLYdsk.js → copy-button-Dejn5heL.js} +1 -1
  187. package/dist/icons-CpfUer49.js +85 -0
  188. package/dist/{icons-CUCz_Sft.d.ts → icons-GQd1xF4e.d.ts} +51 -1
  189. package/dist/styles/activity-header.css +75 -0
  190. package/dist/styles/activity.css +49 -63
  191. package/dist/styles/agent-activity-preview-overlay.css +80 -0
  192. package/dist/styles/agent-activity-preview.css +235 -0
  193. package/dist/styles/agent-attention.css +122 -0
  194. package/dist/styles/agent-chat.css +133 -4
  195. package/dist/styles/app-frame.css +15 -0
  196. package/dist/styles/app-top-bar.css +100 -0
  197. package/dist/styles/avatar.css +0 -1
  198. package/dist/styles/browser-control-overlay.css +184 -0
  199. package/dist/styles/card.css +21 -0
  200. package/dist/styles/checkbox-group.css +69 -0
  201. package/dist/styles/description-list.css +50 -0
  202. package/dist/styles/fieldset.css +11 -0
  203. package/dist/styles/index.css +14 -2
  204. package/dist/styles/mcp-connection-request.css +60 -0
  205. package/dist/styles/mcp-server-picker.css +95 -68
  206. package/dist/styles/message.css +4 -43
  207. package/dist/styles/pricing-page.css +21 -27
  208. package/dist/styles/prompt-input.css +225 -32
  209. package/dist/styles/reasoning.css +1 -55
  210. package/dist/styles/recipes.css +23 -15
  211. package/dist/styles/resizable-side-panel.css +66 -0
  212. package/dist/styles/responsive-sidebar-shell.css +169 -0
  213. package/dist/styles/select.css +10 -0
  214. package/dist/styles/stepper.css +13 -0
  215. package/dist/styles/streamdown.css +0 -4
  216. package/dist/styles/subagent-run.css +55 -38
  217. package/dist/styles/textarea.css +20 -0
  218. package/dist/styles/theme-mode-control.css +72 -0
  219. package/dist/styles/think-execution-status.css +49 -0
  220. package/dist/styles/think-execution-workbench.css +8 -72
  221. package/dist/styles/think-full-app.css +104 -131
  222. package/dist/styles/think-routine-library.css +491 -0
  223. package/dist/styles/think-thread-picker.css +47 -3
  224. package/dist/styles/toggle-group.css +7 -0
  225. package/dist/styles/workspace-explorer.css +511 -64
  226. package/dist/utils/mcp-server-catalog.d.ts +82 -78
  227. package/dist/utils/mcp-server-catalog.js +64 -41
  228. package/dist/utils/structured-code.d.ts +1 -1
  229. package/dist/utils/theme.d.ts +22 -0
  230. package/dist/utils/theme.js +55 -0
  231. package/package.json +34 -28
  232. package/dist/icons-Ba9THQKz.js +0 -64
  233. package/dist/styles/think-resize-handle.css +0 -33
  234. package/dist/styles/think-thread-shell.css +0 -219
@@ -1,22 +1,24 @@
1
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { A as RefreshIcon, D as PencilIcon, k as PlusIcon } from "../icons-Ba9THQKz.js";
2
+ import { F as PlusIcon, H as SteerIcon, I as QueueIcon, K as TrashIcon, L as RefreshIcon, N as PencilIcon } from "../icons-CpfUer49.js";
3
3
  import { Activity, ActivityContent, ActivityPanel, ActivityTrigger } from "./Activity.js";
4
4
  import { Context, ContextContent, ContextContentBody, ContextContentHeader, ContextTrigger, getContextUsage, getContextUsedTokens } from "./Context.js";
5
- import { Button } from "./Button.js";
6
5
  import { MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport } from "./MessageScroller.js";
7
6
  import { ConversationEmptyState } from "./Conversation.js";
8
- import { Message, MessageAction, MessageActions, MessageAttachment, MessageContent, MessageResponse } from "./Message.js";
7
+ import { d as MessageContent, f as MessageResponse, i as MessageAttachment, n as MessageAction, r as MessageActions, t as Message } from "../Message-BkMdE3bS.js";
8
+ import { AgentChatMessageEditor } from "./AgentChatMessageEditor.js";
9
9
  import { Marker, MarkerContent } from "./Marker.js";
10
- import { PromptInput, PromptInputActionAddAttachments, PromptInputActionMenu, PromptInputActionMenuContent, PromptInputActionMenuTrigger, PromptInputApproval, PromptInputAttachments, PromptInputBody, PromptInputButton, PromptInputDictation, PromptInputFooter, PromptInputHeader, PromptInputPermissionSelector, PromptInputSubmit, PromptInputTextarea, PromptInputTools, getApprovalRequestId, getApprovalStateKey, getPendingToolApprovals, usePromptInputAttachments } from "./PromptInput.js";
10
+ import { Menu } from "./Menu.js";
11
+ import { PromptInput, PromptInputActionAddAttachments, PromptInputActionMenu, PromptInputActionMenuContent, PromptInputActionMenuTrigger, PromptInputApproval, PromptInputAttachments, PromptInputBody, PromptInputButton, PromptInputCommandComposer, PromptInputContextSelector, PromptInputDictation, PromptInputFooter, PromptInputHeader, PromptInputPermissionSelector, PromptInputReferences, PromptInputSubmit, PromptInputTextarea, PromptInputTools, getApprovalRequestId, getApprovalStateKey, getPendingToolApprovals, usePromptInputAttachments } from "./PromptInput.js";
11
12
  import { Reasoning, ReasoningContent, ReasoningTrigger } from "./Reasoning.js";
12
13
  import { Source, Sources, SourcesContent, SourcesTrigger } from "./Sources.js";
13
- import { t as CopyButton } from "../copy-button-DUMLYdsk.js";
14
+ import { getToolDisplayName, isToolPartFailed, isToolPartWorking } from "./ThinkChatToolParts.js";
15
+ import { t as CopyButton } from "../copy-button-Dejn5heL.js";
14
16
  import { t as summarizeToolInput } from "../summarize-tool-input-BUJsENSn.js";
15
17
  import * as React from "react";
16
18
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
17
19
  import { isCompactionMessage } from "agents/experimental/memory/utils";
18
20
  import { getToolInput, getToolOutput, getToolPartState } from "@cloudflare/think/react";
19
- import { getToolName, isFileUIPart, isReasoningUIPart, isTextUIPart, isToolUIPart } from "ai";
21
+ import { isFileUIPart, isReasoningUIPart, isTextUIPart, isToolUIPart } from "ai";
20
22
  //#region src/components/AgentChat.tsx
21
23
  const EMPTY_PENDING_APPROVALS = [];
22
24
  const EMPTY_SKIPPED_APPROVAL_IDS = [];
@@ -24,12 +26,9 @@ function createApprovalSessionState(thinkStub) {
24
26
  return {
25
27
  thinkStub,
26
28
  skippedApprovalIds: EMPTY_SKIPPED_APPROVAL_IDS,
27
- permissionMode: "ask"
29
+ permissionMode: "bypass"
28
30
  };
29
31
  }
30
- function isCurrentApprovalSession(state, thinkStub) {
31
- return state.thinkStub === thinkStub;
32
- }
33
32
  function AgentChatAttachButton() {
34
33
  const attachments = usePromptInputAttachments();
35
34
  return /* @__PURE__ */ jsx(PromptInputButton, {
@@ -46,9 +45,22 @@ function AgentChatAddMenu({ children }) {
46
45
  sideOffset: 12,
47
46
  collisionPadding: 8,
48
47
  className: "agent-chat__add-menu",
49
- children: [/* @__PURE__ */ jsx(PromptInputActionAddAttachments, {}), children]
48
+ children: [/* @__PURE__ */ jsxs(Menu.Group, { children: [/* @__PURE__ */ jsx(Menu.GroupLabel, {
49
+ className: "agent-chat__add-menu-group-label",
50
+ children: "Add"
51
+ }), /* @__PURE__ */ jsx(PromptInputActionAddAttachments, {})] }), children]
50
52
  })] });
51
53
  }
54
+ function AgentChatSubmitAction({ status, onStop, allowSubmitWhileBusy, disabled, hasDraft }) {
55
+ const attachments = usePromptInputAttachments();
56
+ return /* @__PURE__ */ jsx(PromptInputSubmit, {
57
+ status,
58
+ onStop,
59
+ allowSubmitWhileBusy,
60
+ hasContent: hasDraft || attachments.files.length > 0,
61
+ disabled
62
+ });
63
+ }
52
64
  /**
53
65
  * Per-message row-size compaction marker from `AIChatAgent` persistence.
54
66
  *
@@ -75,14 +87,6 @@ function getPartKey(part, partIndex) {
75
87
  if ("id" in part && typeof part.id === "string") return `${part.type}-${part.id}`;
76
88
  return `${part.type}-${partIndex}`;
77
89
  }
78
- function isToolPartWorking(part) {
79
- const state = getToolPartState(part);
80
- return state === "loading" || state === "streaming" || state === "waiting-approval";
81
- }
82
- function isToolPartFailed(part) {
83
- const state = getToolPartState(part);
84
- return state === "error" || state === "denied";
85
- }
86
90
  /**
87
91
  * AI SDK exports concrete source part types but no public source-part guard.
88
92
  * Keep these local guards as exact discriminant checks, matching
@@ -97,14 +101,6 @@ function isSourceDocumentPart(part) {
97
101
  return part?.type === "source-document";
98
102
  }
99
103
  /**
100
- * AI SDK emits `step-start` as a native `StepStartUIPart`, but currently exports
101
- * only the type, not an `isStepStartUIPart` helper. Keep this as the exact
102
- * upstream discriminant so step separators do not become a local protocol.
103
- */
104
- function isStepStartPart(part) {
105
- return part.type === "step-start";
106
- }
107
- /**
108
104
  * Session compaction overlay marker from Agents Sessions.
109
105
  *
110
106
  * Agents exports `isCompactionMessage` from `agents/sessions`; it checks the canonical `compaction_`
@@ -150,93 +146,6 @@ function getEditableUserText(message) {
150
146
  const part = message.parts[0];
151
147
  return isTextUIPart(part) && part.text.trim() ? part.text : void 0;
152
148
  }
153
- function AgentChatMessageEditor({ message, originalText, onCancel, onEditAndResend, onSuccess }) {
154
- const [draft, setDraft] = React.useState(originalText);
155
- const [isSubmitting, setIsSubmitting] = React.useState(false);
156
- const [error, setError] = React.useState();
157
- const textareaRef = React.useRef(null);
158
- const labelId = React.useId();
159
- const errorId = React.useId();
160
- const trimmedDraft = draft.trim();
161
- const canSubmit = !isSubmitting && Boolean(trimmedDraft) && trimmedDraft !== originalText.trim();
162
- React.useLayoutEffect(() => {
163
- textareaRef.current?.focus();
164
- const end = textareaRef.current?.value.length ?? 0;
165
- textareaRef.current?.setSelectionRange(end, end);
166
- }, []);
167
- const handleSubmit = async (event) => {
168
- event.preventDefault();
169
- if (!canSubmit) return;
170
- setError(void 0);
171
- setIsSubmitting(true);
172
- try {
173
- await onEditAndResend({
174
- message,
175
- text: trimmedDraft
176
- });
177
- onSuccess();
178
- } catch {
179
- setError("Message wasn’t resent. Try again.");
180
- setIsSubmitting(false);
181
- }
182
- };
183
- return /* @__PURE__ */ jsxs("form", {
184
- className: "message__edit-form",
185
- "aria-busy": isSubmitting,
186
- onSubmit: (event) => void handleSubmit(event),
187
- children: [
188
- /* @__PURE__ */ jsx("label", {
189
- id: labelId,
190
- className: "message__edit-label",
191
- htmlFor: `${labelId}-textarea`,
192
- children: "Edit message"
193
- }),
194
- /* @__PURE__ */ jsx("textarea", {
195
- ref: textareaRef,
196
- id: `${labelId}-textarea`,
197
- className: "message__edit-textarea",
198
- value: draft,
199
- "aria-describedby": error ? errorId : void 0,
200
- "aria-invalid": error ? true : void 0,
201
- disabled: isSubmitting,
202
- rows: 3,
203
- onChange: (event) => {
204
- setDraft(event.currentTarget.value);
205
- if (error) setError(void 0);
206
- },
207
- onKeyDown: (event) => {
208
- if (event.key !== "Escape" || isSubmitting) return;
209
- event.preventDefault();
210
- onCancel();
211
- }
212
- }),
213
- error ? /* @__PURE__ */ jsx("p", {
214
- id: errorId,
215
- className: "message__edit-error",
216
- role: "alert",
217
- children: error
218
- }) : null,
219
- /* @__PURE__ */ jsxs("div", {
220
- className: "message__edit-actions",
221
- children: [/* @__PURE__ */ jsx(Button, {
222
- type: "button",
223
- variant: "outline",
224
- color: "neutral",
225
- size: "lg",
226
- disabled: isSubmitting,
227
- onClick: onCancel,
228
- children: "Cancel"
229
- }), /* @__PURE__ */ jsx(Button, {
230
- type: "submit",
231
- color: "primary",
232
- size: "lg",
233
- disabled: !canSubmit,
234
- children: isSubmitting ? "Resending…" : "Send"
235
- })]
236
- })
237
- ]
238
- });
239
- }
240
149
  function formatSourceTitle(part) {
241
150
  if (part.title) return part.title;
242
151
  if (part.type === "source-document") return part.filename ?? part.mediaType;
@@ -265,7 +174,7 @@ function getSourceRun(parts, start) {
265
174
  return sources;
266
175
  }
267
176
  function describeToolPart(part) {
268
- const name = getToolName(part);
177
+ const name = getToolDisplayName(part);
269
178
  const verb = isToolPartFailed(part) ? `${name} failed` : isToolPartWorking(part) ? `Running ${name}` : `Ran ${name}`;
270
179
  const detail = summarizeToolInput(getToolInput(part));
271
180
  return detail ? `${verb} · ${detail}` : verb;
@@ -282,7 +191,7 @@ function renderToolActivity(part) {
282
191
  return /* @__PURE__ */ jsxs(Activity, {
283
192
  isStreaming: isToolPartWorking(part),
284
193
  children: [/* @__PURE__ */ jsx(ActivityTrigger, { label: describeToolPart(part) }), /* @__PURE__ */ jsxs(ActivityContent, { children: [/* @__PURE__ */ jsx(ActivityPanel, {
285
- label: getToolName(part),
194
+ label: getToolDisplayName(part),
286
195
  text: formatToolValue(getToolInput(part))
287
196
  }), output ? /* @__PURE__ */ jsx(ActivityPanel, {
288
197
  label: "output",
@@ -292,18 +201,20 @@ function renderToolActivity(part) {
292
201
  }) : null] })]
293
202
  });
294
203
  }
295
- function renderDefaultPart(part) {
204
+ function renderDefaultPart(message, part, partIndex, isLastMessage, status) {
296
205
  if (isTextUIPart(part) && part.text) return /* @__PURE__ */ jsx(MessageResponse, { children: part.text });
297
206
  if (isFileUIPart(part)) return /* @__PURE__ */ jsx(MessageAttachment, { part });
298
- if (isReasoningUIPart(part) && part.text) return /* @__PURE__ */ jsxs(Reasoning, {
299
- isStreaming: part.state === "streaming",
300
- children: [/* @__PURE__ */ jsx(ReasoningTrigger, {}), /* @__PURE__ */ jsx(ReasoningContent, { children: part.text })]
301
- });
207
+ if (isReasoningUIPart(part)) {
208
+ if (partIndex !== message.parts.findIndex(isReasoningUIPart)) return null;
209
+ const reasoningText = message.parts.filter(isReasoningUIPart).map((reasoningPart) => reasoningPart.text).join("\n\n");
210
+ if (!reasoningText) return null;
211
+ const lastPart = message.parts.at(-1);
212
+ return /* @__PURE__ */ jsxs(Reasoning, {
213
+ isStreaming: isLastMessage && status === "streaming" && lastPart !== void 0 && isReasoningUIPart(lastPart) && lastPart.state === "streaming",
214
+ children: [/* @__PURE__ */ jsx(ReasoningTrigger, {}), /* @__PURE__ */ jsx(ReasoningContent, { children: reasoningText })]
215
+ });
216
+ }
302
217
  if (isToolUIPart(part)) return renderToolActivity(part);
303
- if (isStepStartPart(part)) return /* @__PURE__ */ jsx(Marker, {
304
- variant: "separator",
305
- children: /* @__PURE__ */ jsx(MarkerContent, { children: "Next step" })
306
- });
307
218
  return null;
308
219
  }
309
220
  /**
@@ -311,8 +222,16 @@ function renderDefaultPart(part) {
311
222
  * transport. Product code that talks to a Cloudflare Think agent should render
312
223
  * `ThinkChat`; use this directly only for plain AI SDK or read-only messages.
313
224
  */
314
- function AgentChat({ className, messages, status = "ready", onSubmit, showComposer = onSubmit !== void 0, onStop, placeholder = "Ask anything...", disabled, emptyState, composerHeader, composerTools, voiceInput, beforeVoiceStart, composerAddMenuItems, notice, onRegenerate, onEditAndResend, onApprovalResponse, thinkStub, onExecutionSettled, pendingApprovals: durableApprovals = EMPTY_PENDING_APPROVALS, contextWindow, renderPart, renderMessageAfter, ref }) {
225
+ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMessage, onRemoveQueuedMessage, status = "ready", onSubmit, showComposer = onSubmit !== void 0, onStop, allowSubmitWhileBusy = false, placeholder = "Ask anything...", disabled, emptyState, composerHeader, composerTools, slashCommands, mentionCommands, contextSelector, composerEndTools, voiceInput, beforeVoiceStart, composerAddMenuItems, notice, onRegenerate, onEditAndResend, onApprovalResponse, thinkStub, permissionModeControl, onExecutionSettled, pendingApprovals: durableApprovals = EMPTY_PENDING_APPROVALS, contextWindow, renderPart, renderMessageAfter, ref }) {
315
226
  const [copyAnnouncement, setCopyAnnouncement] = React.useState("");
227
+ const [composerDraft, setComposerDraft] = React.useState("");
228
+ const [composerReferences, setComposerReferences] = React.useState([]);
229
+ const addComposerReference = React.useCallback((reference) => {
230
+ setComposerReferences((current) => current.some((item) => item.id === reference.id && item.trigger === reference.trigger) ? current : [...current, reference]);
231
+ }, []);
232
+ const removeComposerReference = React.useCallback((reference) => {
233
+ setComposerReferences((current) => current.filter((item) => item.id !== reference.id || item.trigger !== reference.trigger));
234
+ }, []);
316
235
  const copyAnnouncementTimer = React.useRef(null);
317
236
  const announceCopyStatus = React.useCallback((message) => {
318
237
  if (copyAnnouncementTimer.current !== null) window.clearTimeout(copyAnnouncementTimer.current);
@@ -326,23 +245,62 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
326
245
  if (copyAnnouncementTimer.current !== null) window.clearTimeout(copyAnnouncementTimer.current);
327
246
  }, []);
328
247
  const handleSubmit = React.useCallback((message) => {
329
- onSubmit?.(message);
330
- }, [onSubmit]);
248
+ const submission = onSubmit?.({
249
+ ...message,
250
+ ...composerReferences.length ? { references: composerReferences } : {}
251
+ });
252
+ setComposerDraft("");
253
+ setComposerReferences([]);
254
+ return submission;
255
+ }, [composerReferences, onSubmit]);
256
+ const selectComposerCommand = React.useCallback((command, trigger) => {
257
+ const reference = {
258
+ id: command.id,
259
+ value: command.value,
260
+ label: command.label,
261
+ icon: command.icon,
262
+ trigger
263
+ };
264
+ const nextReferences = composerReferences.some((item) => item.id === reference.id && item.trigger === reference.trigger) ? composerReferences : [...composerReferences, reference];
265
+ addComposerReference(reference);
266
+ const catalog = trigger === "@" ? mentionCommands : slashCommands;
267
+ if (catalog?.onSelect) catalog.onSelect(command, {
268
+ value: composerDraft,
269
+ references: nextReferences,
270
+ setValue: setComposerDraft,
271
+ clear: () => setComposerDraft(""),
272
+ addReference: addComposerReference,
273
+ removeReference: removeComposerReference
274
+ });
275
+ else setComposerDraft("");
276
+ }, [
277
+ addComposerReference,
278
+ composerDraft,
279
+ composerReferences,
280
+ mentionCommands,
281
+ removeComposerReference,
282
+ slashCommands
283
+ ]);
331
284
  const [approvalSession, setApprovalSession] = React.useState(() => createApprovalSessionState(thinkStub));
332
- const approvalSessionIsCurrent = isCurrentApprovalSession(approvalSession, thinkStub);
285
+ const approvalSessionIsCurrent = approvalSession.thinkStub === thinkStub;
333
286
  const skippedApprovalIds = approvalSessionIsCurrent ? approvalSession.skippedApprovalIds : EMPTY_SKIPPED_APPROVAL_IDS;
334
- const permissionMode = approvalSessionIsCurrent ? approvalSession.permissionMode : "ask";
287
+ const localPermissionMode = approvalSessionIsCurrent ? approvalSession.permissionMode : "bypass";
288
+ const permissionMode = permissionModeControl?.value ?? localPermissionMode;
335
289
  const updateApprovalSession = React.useCallback((update) => {
336
- setApprovalSession((previous) => update(isCurrentApprovalSession(previous, thinkStub) ? previous : createApprovalSessionState(thinkStub)));
290
+ setApprovalSession((previous) => update(previous.thinkStub === thinkStub ? previous : createApprovalSessionState(thinkStub)));
337
291
  }, [thinkStub]);
338
292
  const setPermissionMode = React.useCallback((next) => {
293
+ if (permissionModeControl) {
294
+ permissionModeControl.onChange(next);
295
+ return;
296
+ }
339
297
  updateApprovalSession((current) => ({
340
298
  ...current,
341
299
  permissionMode: next
342
300
  }));
343
- }, [updateApprovalSession]);
301
+ }, [permissionModeControl, updateApprovalSession]);
344
302
  React.useLayoutEffect(() => {
345
- setApprovalSession((previous) => isCurrentApprovalSession(previous, thinkStub) ? previous : createApprovalSessionState(thinkStub));
303
+ setApprovalSession((previous) => previous.thinkStub === thinkStub ? previous : createApprovalSessionState(thinkStub));
346
304
  }, [thinkStub]);
347
305
  const pendingApprovalItems = [...getPendingToolApprovals(messages, { pausedExecutions: Boolean(thinkStub) }).filter(({ part }) => {
348
306
  if (part.state === "approval-requested" && !onApprovalResponse) return false;
@@ -355,14 +313,14 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
355
313
  ids: /* @__PURE__ */ new Set()
356
314
  });
357
315
  React.useLayoutEffect(() => {
358
- if (isCurrentApprovalSession(autoApprovedIds.current, thinkStub)) return;
316
+ if (autoApprovedIds.current.thinkStub === thinkStub) return;
359
317
  autoApprovedIds.current = {
360
318
  thinkStub,
361
319
  ids: /* @__PURE__ */ new Set()
362
320
  };
363
321
  }, [thinkStub]);
364
322
  React.useEffect(() => {
365
- if (permissionMode !== "bypass") return;
323
+ if (permissionModeControl || permissionMode !== "bypass") return;
366
324
  for (const item of pendingApprovalItems) {
367
325
  const id = "part" in item ? getApprovalRequestId(item.part) : item.approval.executionId;
368
326
  const key = "part" in item ? getApprovalStateKey(item.part) : item.approval.executionId;
@@ -378,22 +336,25 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
378
336
  }
379
337
  }, [
380
338
  permissionMode,
339
+ permissionModeControl,
381
340
  messages,
382
341
  durableApprovals,
383
342
  onApprovalResponse,
384
343
  thinkStub,
385
344
  onExecutionSettled
386
345
  ]);
387
- const pendingApproval = permissionMode === "bypass" ? void 0 : pendingApprovalItems[0];
346
+ const pendingApproval = !permissionModeControl && permissionMode === "bypass" ? void 0 : pendingApprovalItems[0];
388
347
  const contextUsage = contextWindow ? getContextUsage(messages) : void 0;
389
- const newestAssistantIndex = messages.findLastIndex((message) => message.role === "assistant" && !isCompactionMessage$1(message));
348
+ const queuedMessageIds = new Set(queuedMessages.map((message) => message.id));
349
+ const transcriptMessages = queuedMessageIds.size ? messages.filter((message) => !queuedMessageIds.has(message.id)) : messages;
350
+ const newestAssistantIndex = transcriptMessages.findLastIndex((message) => message.role === "assistant" && !isCompactionMessage$1(message));
390
351
  const lastAssistantIndex = onRegenerate && status !== "streaming" && status !== "submitted" ? newestAssistantIndex : -1;
391
- const lastUserIndex = onEditAndResend && !disabled && status !== "streaming" && status !== "submitted" ? messages.findLastIndex((message) => message.role === "user") : -1;
352
+ const lastUserIndex = onEditAndResend && !disabled && status !== "streaming" && status !== "submitted" ? transcriptMessages.findLastIndex((message) => message.role === "user") : -1;
392
353
  const [editingMessageId, setEditingMessageId] = React.useState();
393
354
  const restoreEditFocus = React.useRef(false);
394
355
  const editButtonRef = React.useRef(null);
395
356
  let assistantResponseCount = 0;
396
- const assistantResponseNumbers = messages.map((message) => {
357
+ const assistantResponseNumbers = transcriptMessages.map((message) => {
397
358
  if (message.role !== "assistant" || isCompactionMessage$1(message)) return 0;
398
359
  assistantResponseCount += 1;
399
360
  return assistantResponseCount;
@@ -431,13 +392,13 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
431
392
  children: [/* @__PURE__ */ jsx(MessageScrollerViewport, { children: /* @__PURE__ */ jsxs(MessageScrollerContent, {
432
393
  "aria-busy": status === "streaming" || status === "submitted",
433
394
  className: "agent-chat__transcript-content",
434
- children: [messages.length === 0 ? /* @__PURE__ */ jsx(MessageScrollerItem, {
395
+ children: [transcriptMessages.length === 0 ? /* @__PURE__ */ jsx(MessageScrollerItem, {
435
396
  className: "agent-chat__empty-row",
436
397
  children: emptyState ?? /* @__PURE__ */ jsx(ConversationEmptyState, {
437
398
  title: "Start a conversation",
438
399
  description: "Ask the agent to inspect, plan, or build."
439
400
  })
440
- }) : null, messages.map((message, messageIndex) => /* @__PURE__ */ jsx(MessageScrollerItem, {
401
+ }) : null, transcriptMessages.map((message, messageIndex) => /* @__PURE__ */ jsx(MessageScrollerItem, {
441
402
  messageId: message.id,
442
403
  scrollAnchor: message.role === "user",
443
404
  children: isCompactionMessage$1(message) ? /* @__PURE__ */ jsx(Marker, {
@@ -448,7 +409,7 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
448
409
  children: editingMessageId === message.id && onEditAndResend ? /* @__PURE__ */ jsx(AgentChatMessageEditor, {
449
410
  message,
450
411
  originalText: getEditableUserText(message) ?? "",
451
- onEditAndResend,
412
+ onSubmit: onEditAndResend,
452
413
  onCancel: () => {
453
414
  restoreEditFocus.current = true;
454
415
  setEditingMessageId(void 0);
@@ -459,7 +420,7 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
459
420
  }
460
421
  }, message.id) : /* @__PURE__ */ jsxs(Fragment, { children: [
461
422
  message.parts.map((part, partIndex) => {
462
- const defaultRender = () => renderDefaultPart(part);
423
+ const defaultRender = () => renderDefaultPart(message, part, partIndex, messageIndex === transcriptMessages.length - 1, status);
463
424
  const custom = renderPart?.({
464
425
  message,
465
426
  part,
@@ -517,63 +478,126 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
517
478
  showComposer ? /* @__PURE__ */ jsxs("div", {
518
479
  ref: composerRef,
519
480
  className: "agent-chat__composer",
520
- children: [/* @__PURE__ */ jsx("div", {
521
- className: "agent-chat__notice",
522
- role: "status",
523
- "aria-atomic": "true",
524
- children: notice
525
- }), /* @__PURE__ */ jsx(PromptInput, {
526
- multiple: true,
527
- onSubmit: handleSubmit,
528
- children: pendingApproval ? /* @__PURE__ */ jsx(PromptInputApproval, {
529
- part: "part" in pendingApproval ? pendingApproval.part : void 0,
530
- approval: "approval" in pendingApproval ? pendingApproval.approval : void 0,
531
- count: pendingApprovalItems.length,
532
- onRespond: onApprovalResponse,
533
- thinkStub,
534
- onExecutionSettled,
535
- onSkip: () => {
536
- const id = "part" in pendingApproval ? getApprovalStateKey(pendingApproval.part) : pendingApproval.approval.executionId;
537
- if (id) updateApprovalSession((current) => ({
538
- ...current,
539
- skippedApprovalIds: [...current.skippedApprovalIds, id]
540
- }));
541
- }
542
- }) : /* @__PURE__ */ jsxs(Fragment, { children: [
543
- composerHeader ? /* @__PURE__ */ jsx(PromptInputHeader, { children: composerHeader }) : null,
544
- /* @__PURE__ */ jsx(PromptInputAttachments, {}),
545
- /* @__PURE__ */ jsx(PromptInputBody, { children: /* @__PURE__ */ jsx(PromptInputTextarea, {
546
- "aria-label": "Message",
547
- placeholder,
548
- disabled
549
- }) }),
550
- /* @__PURE__ */ jsxs(PromptInputFooter, { children: [/* @__PURE__ */ jsxs(PromptInputTools, { children: [
551
- /* @__PURE__ */ jsx(AgentChatAddMenu, { children: composerAddMenuItems }),
552
- approvalsWired ? /* @__PURE__ */ jsx(PromptInputPermissionSelector, {
553
- value: permissionMode,
554
- onValueChange: setPermissionMode
555
- }) : null,
556
- composerTools,
557
- voiceInput ? /* @__PURE__ */ jsx(PromptInputDictation, {
558
- voice: voiceInput,
559
- beforeStart: beforeVoiceStart,
560
- disabled
561
- }) : null
562
- ] }), /* @__PURE__ */ jsxs("div", {
563
- className: "prompt-input__footer-end",
564
- children: [contextWindow ? /* @__PURE__ */ jsxs(Context, {
565
- usedTokens: getContextUsedTokens(contextUsage),
566
- maxTokens: contextWindow.maxTokens,
567
- usage: contextUsage,
568
- modelId: contextWindow.modelId,
569
- children: [/* @__PURE__ */ jsx(ContextTrigger, {}), /* @__PURE__ */ jsxs(ContextContent, { children: [/* @__PURE__ */ jsx(ContextContentHeader, {}), /* @__PURE__ */ jsx(ContextContentBody, {})] })]
570
- }) : null, /* @__PURE__ */ jsx(PromptInputSubmit, {
571
- status,
572
- onStop
573
- })]
574
- })] })
575
- ] })
576
- })]
481
+ children: [
482
+ /* @__PURE__ */ jsx("div", {
483
+ className: "agent-chat__notice",
484
+ role: "status",
485
+ "aria-atomic": "true",
486
+ children: notice
487
+ }),
488
+ queuedMessages.length ? /* @__PURE__ */ jsx("section", {
489
+ className: "agent-chat__queued",
490
+ "aria-label": "Queued messages",
491
+ children: /* @__PURE__ */ jsx("ul", {
492
+ className: "agent-chat__queued-list",
493
+ children: queuedMessages.map((message) => {
494
+ const messageText = getMessageText(message) || "Queued message";
495
+ return /* @__PURE__ */ jsxs("li", {
496
+ className: "agent-chat__queued-message",
497
+ children: [
498
+ /* @__PURE__ */ jsx("span", {
499
+ className: "agent-chat__queued-indicator",
500
+ "aria-hidden": "true",
501
+ children: /* @__PURE__ */ jsx(QueueIcon, {})
502
+ }),
503
+ /* @__PURE__ */ jsx("span", {
504
+ className: "agent-chat__queued-text",
505
+ children: messageText
506
+ }),
507
+ onSteerQueuedMessage ? /* @__PURE__ */ jsxs("button", {
508
+ type: "button",
509
+ className: "agent-chat__queued-action",
510
+ "aria-label": `Steer queued message: ${messageText}`,
511
+ onClick: () => onSteerQueuedMessage(message),
512
+ children: [/* @__PURE__ */ jsx(SteerIcon, {}), "Steer"]
513
+ }) : null,
514
+ onRemoveQueuedMessage ? /* @__PURE__ */ jsx("button", {
515
+ type: "button",
516
+ className: "agent-chat__queued-action agent-chat__queued-remove",
517
+ "aria-label": `Remove queued message: ${messageText}`,
518
+ onClick: () => onRemoveQueuedMessage(message),
519
+ children: /* @__PURE__ */ jsx(TrashIcon, {})
520
+ }) : null
521
+ ]
522
+ }, message.id);
523
+ })
524
+ })
525
+ }) : null,
526
+ /* @__PURE__ */ jsx(PromptInput, {
527
+ multiple: true,
528
+ onSubmit: handleSubmit,
529
+ children: pendingApproval ? /* @__PURE__ */ jsx(PromptInputApproval, {
530
+ part: "part" in pendingApproval ? pendingApproval.part : void 0,
531
+ approval: "approval" in pendingApproval ? pendingApproval.approval : void 0,
532
+ count: pendingApprovalItems.length,
533
+ onRespond: onApprovalResponse,
534
+ thinkStub,
535
+ onExecutionSettled,
536
+ onSkip: () => {
537
+ const id = "part" in pendingApproval ? getApprovalStateKey(pendingApproval.part) : pendingApproval.approval.executionId;
538
+ if (id) updateApprovalSession((current) => ({
539
+ ...current,
540
+ skippedApprovalIds: [...current.skippedApprovalIds, id]
541
+ }));
542
+ }
543
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [
544
+ composerHeader ? /* @__PURE__ */ jsx(PromptInputHeader, { children: composerHeader }) : null,
545
+ /* @__PURE__ */ jsx(PromptInputAttachments, {}),
546
+ /* @__PURE__ */ jsxs(PromptInputBody, { children: [/* @__PURE__ */ jsx(PromptInputReferences, {
547
+ references: composerReferences,
548
+ onRemove: removeComposerReference
549
+ }), slashCommands || mentionCommands ? /* @__PURE__ */ jsx(PromptInputCommandComposer, {
550
+ "aria-label": "Message",
551
+ placeholder: composerReferences.length ? "" : placeholder,
552
+ disabled,
553
+ commands: slashCommands?.items ?? [],
554
+ mentionCommands: mentionCommands?.items,
555
+ value: composerDraft,
556
+ onValueChange: setComposerDraft,
557
+ onCommandSelect: selectComposerCommand
558
+ }) : /* @__PURE__ */ jsx(PromptInputTextarea, {
559
+ "aria-label": "Message",
560
+ placeholder,
561
+ disabled,
562
+ value: composerDraft,
563
+ onChange: (event) => setComposerDraft(event.currentTarget.value)
564
+ })] }),
565
+ /* @__PURE__ */ jsxs(PromptInputFooter, { children: [/* @__PURE__ */ jsxs(PromptInputTools, { children: [
566
+ /* @__PURE__ */ jsx(AgentChatAddMenu, { children: composerAddMenuItems }),
567
+ contextSelector ? /* @__PURE__ */ jsx(PromptInputContextSelector, { ...contextSelector }) : null,
568
+ approvalsWired ? /* @__PURE__ */ jsx(PromptInputPermissionSelector, {
569
+ value: permissionMode,
570
+ onValueChange: setPermissionMode
571
+ }) : null,
572
+ composerTools
573
+ ] }), /* @__PURE__ */ jsxs("div", {
574
+ className: "prompt-input__footer-end",
575
+ children: [
576
+ composerEndTools,
577
+ voiceInput ? /* @__PURE__ */ jsx(PromptInputDictation, {
578
+ voice: voiceInput,
579
+ beforeStart: beforeVoiceStart,
580
+ disabled
581
+ }) : null,
582
+ contextWindow ? /* @__PURE__ */ jsxs(Context, {
583
+ usedTokens: getContextUsedTokens(contextUsage),
584
+ maxTokens: contextWindow.maxTokens,
585
+ usage: contextUsage,
586
+ modelId: contextWindow.modelId,
587
+ children: [/* @__PURE__ */ jsx(ContextTrigger, {}), /* @__PURE__ */ jsxs(ContextContent, { children: [/* @__PURE__ */ jsx(ContextContentHeader, {}), /* @__PURE__ */ jsx(ContextContentBody, {})] })]
588
+ }) : null,
589
+ /* @__PURE__ */ jsx(AgentChatSubmitAction, {
590
+ status,
591
+ onStop,
592
+ allowSubmitWhileBusy: Boolean(allowSubmitWhileBusy),
593
+ disabled,
594
+ hasDraft: Boolean(composerDraft.trim() || composerReferences.length)
595
+ })
596
+ ]
597
+ })] })
598
+ ] })
599
+ })
600
+ ]
577
601
  }) : null
578
602
  ]
579
603
  });
@@ -0,0 +1,29 @@
1
+ import * as React from "react";
2
+ import { UIMessage } from "ai";
3
+
4
+ //#region src/components/AgentChatMessageEditor.d.ts
5
+ interface AgentChatMessageEditorProps<MessageT extends UIMessage = UIMessage> {
6
+ /** Whole upstream message being edited, including app metadata and typed data parts. */
7
+ message: MessageT;
8
+ originalText: string;
9
+ onCancel: () => void;
10
+ onSubmit: (input: {
11
+ message: MessageT;
12
+ text: string;
13
+ }) => void | Promise<void>;
14
+ onSuccess?: () => void;
15
+ }
16
+ /**
17
+ * Edit-and-resend form for a chat message. It composes the shared Base UI
18
+ * Form/Field wrappers and Textarea recipe so validation, labels, focus, and
19
+ * disabled states stay owned by the design-system primitives.
20
+ */
21
+ declare function AgentChatMessageEditor<MessageT extends UIMessage = UIMessage>({
22
+ message,
23
+ originalText,
24
+ onCancel,
25
+ onSubmit,
26
+ onSuccess
27
+ }: AgentChatMessageEditorProps<MessageT>): React.JSX.Element;
28
+ //#endregion
29
+ export { AgentChatMessageEditor, AgentChatMessageEditorProps };