@mcp-b/react-components 0.58.1 → 0.59.1

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 (164) hide show
  1. package/dist/{CodeBlock-Bs_Z03eC.js → CodeBlock-B4K656LO.js} +1 -1
  2. package/dist/{EmployeeChrome-DsdIek0l.d.ts → EmployeeChrome-QSki0QT4.d.ts} +4 -4
  3. package/dist/{ExecutionResult-BSZsUbrL.js → ExecutionResult-Wd1sKAvD.js} +2 -2
  4. package/dist/{FileTree-DyLBn7O_.js → FileTree-BpCJuvji.js} +1 -1
  5. package/dist/{ManagerOffice-C8AQcaXs.js → ManagerOffice-BaHSBcSF.js} +4 -4
  6. package/dist/{ResponsiveSidebarShell-DoZlSP30.d.ts → ResponsiveSidebarShell-DzBGlRJF.d.ts} +23 -8
  7. package/dist/{SetupChecklist-CKQ-mKYt.js → SetupChecklist-BNK2XFaI.js} +2 -2
  8. package/dist/{ThinkChatActivity-BkGjTY4r.d.ts → ThinkChatActivity-C4_hPEmb.d.ts} +20 -4
  9. package/dist/{ThinkChatActivitySummary-DZVy3uQV.d.ts → ThinkChatActivitySummary-ChJ8Iu2T.d.ts} +3 -3
  10. package/dist/{ThinkChatToolParts-BucHi63O.d.ts → ThinkChatToolParts-BrntWlpa.d.ts} +29 -3
  11. package/dist/{WorkspaceConceptPanel-97ZyVpZI.js → WorkspaceConceptPanel-D21iRsWm.js} +7 -4
  12. package/dist/{WorkspaceFileView-M2jC2P4p.js → WorkspaceFileView-5SHsjamf.js} +84 -78
  13. package/dist/app-bar-outlet-CNfNzY4Y.js +6 -0
  14. package/dist/components/agents-sdk/AgentActivity.js +1 -1
  15. package/dist/components/agents-sdk/AgentChat.js +7 -7
  16. package/dist/components/agents-sdk/BrowserLiveScreen.js +50 -12
  17. package/dist/components/agents-sdk/BrowserLiveView.js +1 -1
  18. package/dist/components/agents-sdk/BrowserReplay.js +1 -1
  19. package/dist/components/agents-sdk/BrowserRunPanel.js +1 -1
  20. package/dist/components/agents-sdk/EmployeeApp.d.ts +2 -3
  21. package/dist/components/agents-sdk/EmployeeApp.js +5 -5
  22. package/dist/components/agents-sdk/EmployeeChat.js +4 -4
  23. package/dist/components/agents-sdk/EmployeeChrome.d.ts +1 -1
  24. package/dist/components/agents-sdk/EmployeeChrome.js +219 -207
  25. package/dist/components/agents-sdk/EmployeeSchedules.d.ts +1 -1
  26. package/dist/components/agents-sdk/EmployeeSchedules.js +7 -7
  27. package/dist/components/agents-sdk/EmployeeStartScreen.d.ts +1 -1
  28. package/dist/components/agents-sdk/EmployeeStartScreen.js +3 -3
  29. package/dist/components/agents-sdk/ExecutionBoard.js +4 -4
  30. package/dist/components/agents-sdk/ManagerAccountActions.js +2 -2
  31. package/dist/components/agents-sdk/ManagerOffice.js +1 -1
  32. package/dist/components/agents-sdk/ManagerOfficeScreens.d.ts +1 -1
  33. package/dist/components/agents-sdk/ManagerOfficeScreens.js +6 -19
  34. package/dist/components/agents-sdk/McpConnectionRequest.js +2 -2
  35. package/dist/components/agents-sdk/McpConnectorForm.js +1 -1
  36. package/dist/components/agents-sdk/McpPluginCatalog.js +2 -2
  37. package/dist/components/agents-sdk/McpServerPicker.js +2 -2
  38. package/dist/components/agents-sdk/ModelEndpointDialog.js +1 -1
  39. package/dist/components/agents-sdk/ModelSelector.js +5 -5
  40. package/dist/components/agents-sdk/PromptInputApproval.js +1 -1
  41. package/dist/components/agents-sdk/PromptInputCommands.js +1 -1
  42. package/dist/components/agents-sdk/SubagentRunIndicator.js +1 -1
  43. package/dist/components/agents-sdk/SubagentRunPanel.d.ts +8 -9
  44. package/dist/components/agents-sdk/SubagentRunPanel.js +133 -122
  45. package/dist/components/agents-sdk/SubagentRunSelector.js +1 -1
  46. package/dist/components/agents-sdk/ThinkChat.d.ts +1 -1
  47. package/dist/components/agents-sdk/ThinkChat.js +26 -3
  48. package/dist/components/agents-sdk/ThinkChatActivity.d.ts +1 -1
  49. package/dist/components/agents-sdk/ThinkChatActivity.js +110 -110
  50. package/dist/components/agents-sdk/ThinkChatActivitySummary.d.ts +1 -1
  51. package/dist/components/agents-sdk/ThinkChatActivitySummary.js +183 -40
  52. package/dist/components/agents-sdk/ThinkChatToolPanels.d.ts +8 -4
  53. package/dist/components/agents-sdk/ThinkChatToolPanels.js +310 -64
  54. package/dist/components/agents-sdk/ThinkChatToolParts.d.ts +2 -2
  55. package/dist/components/agents-sdk/ThinkChatToolParts.js +71 -1
  56. package/dist/components/agents-sdk/ThinkExecutionDetail.js +2 -2
  57. package/dist/components/agents-sdk/ThinkExecutionStatus.js +1 -1
  58. package/dist/components/agents-sdk/ThinkExecutionWorkbench.d.ts +3 -4
  59. package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +8 -8
  60. package/dist/components/agents-sdk/ThinkFullApp.d.ts +1 -1
  61. package/dist/components/agents-sdk/ThinkFullApp.js +6 -1
  62. package/dist/components/agents-sdk/ThinkRecoveryNotice.js +1 -1
  63. package/dist/components/agents-sdk/ThinkRoutineActions.js +15 -23
  64. package/dist/components/agents-sdk/ThinkRoutineBrowser.js +2 -2
  65. package/dist/components/agents-sdk/ThinkRoutineDetail.js +1 -1
  66. package/dist/components/agents-sdk/ThinkRoutineForm.js +6 -6
  67. package/dist/components/agents-sdk/ThinkRoutineRuns.js +1 -1
  68. package/dist/components/agents-sdk/ThinkThreadPicker.js +3 -3
  69. package/dist/components/agents-sdk/WorkbenchBack.js +1 -1
  70. package/dist/components/agents-sdk/WorkspaceBrowser.js +1 -1
  71. package/dist/components/agents-sdk/WorkspaceCorrespondence.js +7 -7
  72. package/dist/components/agents-sdk/WorkspaceExecution.js +146 -139
  73. package/dist/components/agents-sdk/WorkspaceExecutionTable.js +5 -5
  74. package/dist/components/agents-sdk/WorkspaceExplorer.js +3 -3
  75. package/dist/components/agents-sdk/WorkspaceFileView.js +1 -1
  76. package/dist/components/agents-sdk/WorkspaceHeader.js +27 -29
  77. package/dist/components/agents-sdk/WorkspaceMountManager.js +1 -1
  78. package/dist/components/agents-sdk/WorkspaceProject.js +6 -6
  79. package/dist/components/agents-sdk/WorkspaceUserScript.js +6 -6
  80. package/dist/components/ai-sdk/Activity.d.ts +1 -1
  81. package/dist/components/ai-sdk/Activity.js +85 -7
  82. package/dist/components/ai-sdk/AgentChatMessageEditor.js +1 -1
  83. package/dist/components/ai-sdk/AgentChatStartScreen.js +1 -1
  84. package/dist/components/ai-sdk/Approval.js +4 -3
  85. package/dist/components/ai-sdk/Artifact.js +1 -1
  86. package/dist/components/ai-sdk/ChainOfThought.js +1 -1
  87. package/dist/components/ai-sdk/Checkpoint.js +1 -1
  88. package/dist/components/ai-sdk/CodeBlock.js +1 -1
  89. package/dist/components/ai-sdk/ComposerLink.js +2 -2
  90. package/dist/components/ai-sdk/ConnectedAppCards.js +66 -48
  91. package/dist/components/ai-sdk/Context.js +1 -1
  92. package/dist/components/ai-sdk/Conversation.js +2 -2
  93. package/dist/components/ai-sdk/ExpansionState.d.ts +16 -6
  94. package/dist/components/ai-sdk/ExpansionState.js +25 -7
  95. package/dist/components/ai-sdk/Goal.js +1 -1
  96. package/dist/components/ai-sdk/MediaPreviewCard.js +2 -2
  97. package/dist/components/ai-sdk/Message.js +2 -2
  98. package/dist/components/ai-sdk/MessageScroller.js +1 -1
  99. package/dist/components/ai-sdk/MessageScrollerVirtual.js +99 -12
  100. package/dist/components/ai-sdk/Plan.js +1 -1
  101. package/dist/components/ai-sdk/PromptInput.js +13 -9
  102. package/dist/components/ai-sdk/PromptInputComposerEditor.js +2 -2
  103. package/dist/components/ai-sdk/Queue.js +2 -2
  104. package/dist/components/ai-sdk/Reasoning.js +1 -1
  105. package/dist/components/ai-sdk/Sources.js +1 -1
  106. package/dist/components/ai-sdk/Task.js +1 -1
  107. package/dist/components/ai-sdk/ToolInvocation.d.ts +8 -0
  108. package/dist/components/ai-sdk/ToolInvocation.js +45 -19
  109. package/dist/components/extension/ChatGptSignInScreen.js +1 -1
  110. package/dist/components/extension/CodexModelSelector.js +2 -2
  111. package/dist/components/extension/ConversationTabPicker.js +2 -2
  112. package/dist/components/foundations/Checkbox.js +1 -1
  113. package/dist/components/foundations/Collapsible.js +1 -1
  114. package/dist/components/foundations/ContextMenu.js +1 -1
  115. package/dist/components/foundations/Menubar.js +1 -1
  116. package/dist/components/foundations/SearchField.js +1 -1
  117. package/dist/components/foundations/Select.js +1 -1
  118. package/dist/components/foundations/Stepper.js +1 -1
  119. package/dist/components/foundations/Toast.js +1 -1
  120. package/dist/components/foundations/ToggleGroup.js +1 -1
  121. package/dist/components/foundations/icons.js +1 -1
  122. package/dist/components/general-purpose/AccountSignInDialog.js +1 -1
  123. package/dist/components/general-purpose/Commit.js +2 -2
  124. package/dist/components/general-purpose/EnvironmentVariables.js +2 -2
  125. package/dist/components/general-purpose/FileTree.js +1 -1
  126. package/dist/components/general-purpose/PricingPlanCard.js +2 -2
  127. package/dist/components/general-purpose/PricingUsageCalculator.js +2 -2
  128. package/dist/components/general-purpose/ResponsiveSidebarShell.d.ts +2 -2
  129. package/dist/components/general-purpose/ResponsiveSidebarShell.js +163 -88
  130. package/dist/components/general-purpose/SettingsFormDialog.js +2 -2
  131. package/dist/components/general-purpose/SetupChecklist.js +1 -1
  132. package/dist/components/general-purpose/Terminal.js +3 -3
  133. package/dist/components/general-purpose/TestResults.js +1 -1
  134. package/dist/components/general-purpose/ThemeModeControl.js +1 -1
  135. package/dist/components/general-purpose/WebPreview.js +2 -2
  136. package/dist/components/nanites/AgentConnection.js +2 -2
  137. package/dist/components/nanites/AgentToolDetail.d.ts +1 -3
  138. package/dist/components/nanites/AgentToolDetail.js +30 -39
  139. package/dist/{copy-button-M4sAp9xS.js → copy-button-BsmxSSeD.js} +1 -1
  140. package/dist/merge-refs-DAh6reu8.js +26 -0
  141. package/dist/styles/activity.css +74 -0
  142. package/dist/styles/agent-chat.css +8 -1
  143. package/dist/styles/agent-tool-detail.css +2 -17
  144. package/dist/styles/app-top-bar.css +6 -7
  145. package/dist/styles/base.css +1 -1
  146. package/dist/styles/employee-chrome.css +0 -7
  147. package/dist/styles/message.css +1 -1
  148. package/dist/styles/responsive-sidebar-shell.css +10 -25
  149. package/dist/styles/scroll-area.css +16 -0
  150. package/dist/styles/scrollbars.css +55 -41
  151. package/dist/styles/search-field.css +0 -1
  152. package/dist/styles/subagent-run.css +36 -196
  153. package/dist/styles/think-chat-tool-panels.css +38 -5
  154. package/dist/styles/think-execution-workbench.css +4 -0
  155. package/dist/styles/think-full-app.css +1 -6
  156. package/dist/styles/workspace-concepts.css +6 -39
  157. package/dist/styles/workspace-explorer.css +4 -11
  158. package/dist/{workspace-assets-DVn0d-fN.js → workspace-assets-RD6IhOyh.js} +1 -1
  159. package/dist/{workspace-delete-DfloiBWp.js → workspace-delete-CrNGUuBp.js} +1 -1
  160. package/package.json +2 -2
  161. package/dist/components/agents-sdk/SubagentRunDetails.d.ts +0 -40
  162. package/dist/components/agents-sdk/SubagentRunDetails.js +0 -98
  163. package/dist/merge-refs-DF_7w2x_.js +0 -18
  164. package/dist/{icons-DvlrWt54.js → icons-Cn3vWZRs.js} +1 -1
@@ -1,11 +1,10 @@
1
- import { B as PlusIcon, C as FolderIcon, G as SlackIcon, P as MonitorIcon, R as PencilIcon, W as SidebarIcon, r as ArrowLeftIcon, tt as WarningIcon } from "../../icons-DvlrWt54.js";
2
- import { IconButton } from "../foundations/IconButton.js";
1
+ import { B as PlusIcon, C as FolderIcon, G as SlackIcon, P as MonitorIcon, R as PencilIcon, r as ArrowLeftIcon, tt as WarningIcon } from "../../icons-Cn3vWZRs.js";
3
2
  import { EmptyState } from "../foundations/EmptyState.js";
4
3
  import { AppTopBar } from "../general-purpose/AppTopBar.js";
5
4
  import { ResponsiveSidebarShell } from "../general-purpose/ResponsiveSidebarShell.js";
6
5
  import { ThinkThreadPicker } from "./ThinkThreadPicker.js";
7
6
  import { EmployeeChrome } from "./EmployeeChrome.js";
8
- import { n as ManagerOfficeSidebar, r as ManagerOfficeSidebarAlert, t as ManagerOffice } from "../../ManagerOffice-C8AQcaXs.js";
7
+ import { n as ManagerOfficeSidebar, r as ManagerOfficeSidebarAlert, t as ManagerOffice } from "../../ManagerOffice-BaHSBcSF.js";
9
8
  import "react";
10
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
10
  //#region src/components/agents-sdk/ManagerOfficeScreens.tsx
@@ -46,18 +45,12 @@ function ManagerWorkShell({ employees, employee, renderOfficeLink, officeActions
46
45
  },
47
46
  ...chrome.workbenchNavigation ?? []
48
47
  ],
49
- sidebar: ({ closeSidebar, closeSidebarOnCompact }) => /* @__PURE__ */ jsx(ManagerOfficeSidebar, {
48
+ sidebar: ({ closeSidebarOnCompact }) => /* @__PURE__ */ jsx(ManagerOfficeSidebar, {
50
49
  layout: "chat",
51
50
  employees,
52
51
  selectedEmployeeId: employee.id,
53
52
  closeSidebarOnCompact,
54
- officeActions: /* @__PURE__ */ jsxs(Fragment, { children: [officeActions, /* @__PURE__ */ jsx(IconButton, {
55
- label: "Hide workforce",
56
- variant: "ghost",
57
- size: "sm",
58
- onClick: closeSidebar,
59
- children: /* @__PURE__ */ jsx(SidebarIcon, {})
60
- })] }),
53
+ officeActions,
61
54
  renderLink: (destination) => {
62
55
  if (destination.kind === "employee" && "work" in destination.employee) {
63
56
  const first = destination.employee.work[0];
@@ -143,18 +136,12 @@ function ManagerOfficeScreen({ employees, renderLink, view, emptyOfficeAction, o
143
136
  className: "employee-shell__navigation",
144
137
  sidebarLabel: "employees",
145
138
  showMainLabel: "Show workforce",
146
- sidebar: ({ closeSidebar, closeSidebarOnCompact }) => /* @__PURE__ */ jsx(ManagerOfficeSidebar, {
139
+ sidebar: ({ closeSidebarOnCompact }) => /* @__PURE__ */ jsx(ManagerOfficeSidebar, {
147
140
  employees,
148
141
  renderLink,
149
142
  selectedEmployeeId: employee?.id ?? null,
150
143
  closeSidebarOnCompact,
151
- officeActions: /* @__PURE__ */ jsxs(Fragment, { children: [officeActions, /* @__PURE__ */ jsx(IconButton, {
152
- label: "Hide workforce",
153
- variant: "ghost",
154
- size: "sm",
155
- onClick: closeSidebar,
156
- children: /* @__PURE__ */ jsx(SidebarIcon, {})
157
- })] })
144
+ officeActions
158
145
  }),
159
146
  bar: {
160
147
  label: "Workforce controls",
@@ -1,11 +1,11 @@
1
1
  import { t as cx } from "../../class-names-BiMDVpUo.js";
2
- import { K as SpinnerIcon, d as CheckIcon, tt as WarningIcon } from "../../icons-DvlrWt54.js";
2
+ import { K as SpinnerIcon, d as CheckIcon, tt as WarningIcon } from "../../icons-Cn3vWZRs.js";
3
3
  import { Button } from "../foundations/Button.js";
4
- import { AgentAttention, AgentAttentionActions, AgentAttentionBody, AgentAttentionHeader } from "../ai-sdk/AgentAttention.js";
5
4
  import { a as formatErrorMessage } from "../../format-CWaZEp5o.js";
6
5
  import { DescriptionList } from "../foundations/DescriptionList.js";
7
6
  import { McpServerIcon } from "./McpServerIcon.js";
8
7
  import { t as getMcpServerProjection } from "../../mcp-server-mAErsxHU.js";
8
+ import { AgentAttention, AgentAttentionActions, AgentAttentionBody, AgentAttentionHeader } from "../ai-sdk/AgentAttention.js";
9
9
  import * as React from "react";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  import { getToolPartState } from "@cloudflare/think/react";
@@ -1,9 +1,9 @@
1
1
  import { CUSTOM_MCP_SERVER_CARD } from "../../utils/mcp-server-catalog.js";
2
2
  import { t as cx } from "../../class-names-BiMDVpUo.js";
3
3
  import { Button } from "../foundations/Button.js";
4
+ import { a as formatErrorMessage } from "../../format-CWaZEp5o.js";
4
5
  import { Field } from "../foundations/Field.js";
5
6
  import { Form } from "../foundations/Form.js";
6
- import { a as formatErrorMessage } from "../../format-CWaZEp5o.js";
7
7
  import { Fieldset } from "../foundations/Fieldset.js";
8
8
  import * as React from "react";
9
9
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,8 +1,7 @@
1
1
  import { CUSTOM_MCP_SERVER_CARD } from "../../utils/mcp-server-catalog.js";
2
2
  import { t as cx } from "../../class-names-BiMDVpUo.js";
3
- import { B as PlusIcon, K as SpinnerIcon, o as ArrowUpRightIcon, rt as XIcon, tt as WarningIcon, y as EllipsisIcon } from "../../icons-DvlrWt54.js";
3
+ import { B as PlusIcon, K as SpinnerIcon, o as ArrowUpRightIcon, rt as XIcon, tt as WarningIcon, y as EllipsisIcon } from "../../icons-Cn3vWZRs.js";
4
4
  import { Button } from "../foundations/Button.js";
5
- import { AgentAttention, AgentAttentionBody, AgentAttentionHeader } from "../ai-sdk/AgentAttention.js";
6
5
  import { IconButton } from "../foundations/IconButton.js";
7
6
  import { Dialog } from "../foundations/Dialog.js";
8
7
  import { a as formatErrorMessage } from "../../format-CWaZEp5o.js";
@@ -12,6 +11,7 @@ import { McpServerIcon } from "./McpServerIcon.js";
12
11
  import { SearchField } from "../foundations/SearchField.js";
13
12
  import { t as getMcpServerProjection } from "../../mcp-server-mAErsxHU.js";
14
13
  import { McpServerSetupDialog } from "./McpServerPicker.js";
14
+ import { AgentAttention, AgentAttentionBody, AgentAttentionHeader } from "../ai-sdk/AgentAttention.js";
15
15
  import * as React from "react";
16
16
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
17
17
  //#region src/components/agents-sdk/McpPluginCatalog.tsx
@@ -1,9 +1,9 @@
1
1
  import { n as mergeBaseClassName } from "../../class-names-BiMDVpUo.js";
2
- import { K as SpinnerIcon, N as MinusIcon, d as CheckIcon, tt as WarningIcon } from "../../icons-DvlrWt54.js";
2
+ import { K as SpinnerIcon, N as MinusIcon, d as CheckIcon, tt as WarningIcon } from "../../icons-Cn3vWZRs.js";
3
3
  import { buttonVariants } from "../foundations/Button.js";
4
- import { Menu } from "../foundations/Menu.js";
5
4
  import { Dialog } from "../foundations/Dialog.js";
6
5
  import { a as formatErrorMessage } from "../../format-CWaZEp5o.js";
6
+ import { Menu } from "../foundations/Menu.js";
7
7
  import { PromptInputActionMenu, PromptInputActionMenuContent, PromptInputActionMenuTrigger } from "../ai-sdk/PromptInput.js";
8
8
  import { McpServerIcon } from "./McpServerIcon.js";
9
9
  import { t as getMcpServerProjection } from "../../mcp-server-mAErsxHU.js";
@@ -1,6 +1,6 @@
1
1
  import { Field } from "../foundations/Field.js";
2
- import { Select } from "../foundations/Select.js";
3
2
  import { SettingsFormDialog } from "../general-purpose/SettingsFormDialog.js";
3
+ import { Select } from "../foundations/Select.js";
4
4
  import { Checkbox } from "../foundations/Checkbox.js";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region src/components/agents-sdk/ModelEndpointDialog.tsx
@@ -1,13 +1,13 @@
1
1
  import { t as cx } from "../../class-names-BiMDVpUo.js";
2
- import { U as SearchIcon, f as ChevronDownIcon } from "../../icons-DvlrWt54.js";
2
+ import { U as SearchIcon, f as ChevronDownIcon } from "../../icons-Cn3vWZRs.js";
3
+ import { ScrollArea } from "../foundations/ScrollArea.js";
3
4
  import { Button } from "../foundations/Button.js";
4
- import { Autocomplete } from "../foundations/Autocomplete.js";
5
5
  import { Dialog } from "../foundations/Dialog.js";
6
6
  import { c as titleCase } from "../../format-CWaZEp5o.js";
7
- import { Separator } from "../foundations/Separator.js";
8
- import { ScrollArea } from "../foundations/ScrollArea.js";
9
- import { t as ProviderLogo } from "../../provider-logos-DWYY8wNz.js";
7
+ import { Autocomplete } from "../foundations/Autocomplete.js";
10
8
  import { EmptyState } from "../foundations/EmptyState.js";
9
+ import { t as ProviderLogo } from "../../provider-logos-DWYY8wNz.js";
10
+ import { Separator } from "../foundations/Separator.js";
11
11
  import * as React from "react";
12
12
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
13
  import { createPortal } from "react-dom";
@@ -1,6 +1,6 @@
1
1
  import { t as cx } from "../../class-names-BiMDVpUo.js";
2
- import { ToolApproval } from "../ai-sdk/ToolApproval.js";
3
2
  import { ThinkExecutionApproval, ThinkPendingApproval, getPausedExecution } from "./ThinkPendingApproval.js";
3
+ import { ToolApproval } from "../ai-sdk/ToolApproval.js";
4
4
  import "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { isToolUIPart } from "ai";
@@ -1,6 +1,6 @@
1
1
  import { composerLinkHref } from "../../utils/composer-link.js";
2
2
  import { findCatalogMcpServerCard, getMcpServerIconSrc } from "../../utils/mcp-server-catalog.js";
3
- import { A as McpIcon, c as BoxIcon } from "../../icons-DvlrWt54.js";
3
+ import { A as McpIcon, c as BoxIcon } from "../../icons-Cn3vWZRs.js";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  //#region src/components/agents-sdk/PromptInputCommands.tsx
6
6
  function mcpServerCommandIcon(server) {
@@ -1,5 +1,5 @@
1
1
  import { t as cx } from "../../class-names-BiMDVpUo.js";
2
- import { K as SpinnerIcon, Y as StopIcon, d as CheckIcon, tt as WarningIcon } from "../../icons-DvlrWt54.js";
2
+ import { K as SpinnerIcon, Y as StopIcon, d as CheckIcon, tt as WarningIcon } from "../../icons-Cn3vWZRs.js";
3
3
  import { r as firstLine, s as textLines } from "../../format-CWaZEp5o.js";
4
4
  import "react";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -1,5 +1,4 @@
1
1
  import { n as AgentToolRunValue, t as AgentToolEventsValue } from "../../AgentToolRunsContext-DniwGn96.js";
2
- import { ExpansionStore } from "../ai-sdk/ExpansionState.js";
3
2
  import * as React from "react";
4
3
  import { AgentToolRunPart } from "agents/agent-tools";
5
4
  //#region src/components/agents-sdk/SubagentRunPanel.d.ts
@@ -19,22 +18,22 @@ export interface SubagentRunPanelProviderProps {
19
18
  children: React.ReactNode;
20
19
  }
21
20
  interface SubagentRunPanelValue extends Pick<SubagentRunPanelProviderProps, "agentTools" | "selectedRunId" | "parentRunning"> {
22
- open: boolean;
23
- setOpen: (open: boolean) => void;
24
- hiddenCompleted: ReadonlySet<string>;
25
- setHiddenCompleted: (ids: ReadonlySet<string>) => void;
26
- reportDisclosures: ExpansionStore;
27
- restoreFocusRunId: React.RefObject<string | undefined>;
21
+ /** Set while a run is open, so coming back lands on the pill that led there. */
22
+ restoreFocus: React.RefObject<boolean>;
28
23
  commands: Readonly<Record<string, CommandState>>;
29
24
  stopCurrentWork: () => Promise<void>;
30
25
  stopRun: (runId: string) => Promise<void>;
31
26
  }
32
- /** A thread's transient controls/disclosure state; run facts remain in the SDK value. */
27
+ /** A thread's transient Stop commands and focus return; run facts remain in the SDK value. */
33
28
  export declare function SubagentRunPanelProvider({ scopeKey, agentTools, selectedRunId, parentRunning, onStopCurrentWork, onStopRun, children }: SubagentRunPanelProviderProps): React.JSX.Element;
34
29
  export declare function useOptionalSubagentRunPanel(): SubagentRunPanelValue | null;
35
30
  export interface SubagentRunPanelProps {
36
31
  renderRunLink: (run: AgentToolRunValue) => React.ReactElement;
37
32
  }
38
- /** Parent-scoped run queue composed beside queued prompts above the parent composer. */
33
+ /**
34
+ * Parent-scoped delegated work, collapsed to one pill above the composer — the
35
+ * shipped Codex "N background agents" row. The runs open in a popover on
36
+ * demand, so the dock never grows with the roster.
37
+ */
39
38
  export declare function SubagentRunPanel({ renderRunLink }: SubagentRunPanelProps): React.JSX.Element | null;
40
39
  //#endregion
@@ -1,9 +1,12 @@
1
- import { createExpansionStore } from "../ai-sdk/ExpansionState.js";
2
- import { Button } from "../foundations/Button.js";
3
- import { Queue, QueueItem, QueueItemAction, QueueItemActions, QueueItemContent, QueueItemDescription, QueueList, QueueSection, QueueSectionActions, QueueSectionContent, QueueSectionLabel, QueueSectionTrigger } from "../ai-sdk/Queue.js";
4
- import { getSubagentRunName } from "./SubagentRunIndicator.js";
1
+ import { J as SquareIcon, K as SpinnerIcon } from "../../icons-Cn3vWZRs.js";
2
+ import { buttonVariants } from "../foundations/Button.js";
3
+ import { Tooltip } from "../foundations/Tooltip.js";
4
+ import { IconButton } from "../foundations/IconButton.js";
5
+ import { SubagentRunIndicator, getSubagentRunName } from "./SubagentRunIndicator.js";
5
6
  import { useOptionalAgentChatQueue } from "./AgentChatQueue.js";
6
- import { AgentChatNotice, AgentChatPromptTray } from "./AgentChat.js";
7
+ import { Queue, QueueItem, QueueItemActions, QueueItemContent, QueueItemDescription, QueueList } from "../ai-sdk/Queue.js";
8
+ import { AgentChatNotice } from "./AgentChat.js";
9
+ import { Popover } from "../foundations/Popover.js";
7
10
  import { SubagentRunSelector } from "./SubagentRunSelector.js";
8
11
  import * as React from "react";
9
12
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -14,30 +17,19 @@ const SubagentRunPanelContext = React.createContext(null);
14
17
  function createPanelState(scopeKey, selectedRunId) {
15
18
  return {
16
19
  scopeKey,
17
- open: true,
18
- hiddenCompleted: /* @__PURE__ */ new Set(),
19
20
  commands: {},
20
- reportDisclosures: createExpansionStore(),
21
21
  inFlight: /* @__PURE__ */ new Map(),
22
- restoreFocusRunId: { current: selectedRunId }
22
+ restoreFocus: { current: Boolean(selectedRunId) }
23
23
  };
24
24
  }
25
- /** A thread's transient controls/disclosure state; run facts remain in the SDK value. */
25
+ /** A thread's transient Stop commands and focus return; run facts remain in the SDK value. */
26
26
  function SubagentRunPanelProvider({ scopeKey, agentTools, selectedRunId, parentRunning, onStopCurrentWork, onStopRun, children }) {
27
27
  const [state, setState] = React.useState(() => createPanelState(scopeKey, selectedRunId));
28
28
  if (state.scopeKey !== scopeKey) setState(createPanelState(scopeKey, selectedRunId));
29
- const { open, hiddenCompleted, commands, reportDisclosures, inFlight, restoreFocusRunId } = state;
30
- const setOpen = React.useCallback((open) => setState((current) => current.inFlight === inFlight ? {
31
- ...current,
32
- open
33
- } : current), [inFlight]);
34
- const setHiddenCompleted = React.useCallback((hiddenCompleted) => setState((current) => current.inFlight === inFlight ? {
35
- ...current,
36
- hiddenCompleted
37
- } : current), [inFlight]);
29
+ const { commands, inFlight, restoreFocus } = state;
38
30
  React.useLayoutEffect(() => {
39
- if (selectedRunId) restoreFocusRunId.current = selectedRunId;
40
- }, [restoreFocusRunId, selectedRunId]);
31
+ if (selectedRunId) restoreFocus.current = true;
32
+ }, [restoreFocus, selectedRunId]);
41
33
  const execute = React.useCallback((key, command) => {
42
34
  const pending = inFlight.get(key);
43
35
  if (pending) return pending;
@@ -66,12 +58,7 @@ function SubagentRunPanelProvider({ scopeKey, agentTools, selectedRunId, parentR
66
58
  agentTools,
67
59
  selectedRunId,
68
60
  parentRunning,
69
- open,
70
- setOpen,
71
- hiddenCompleted,
72
- setHiddenCompleted,
73
- reportDisclosures,
74
- restoreFocusRunId,
61
+ restoreFocus,
75
62
  commands,
76
63
  stopCurrentWork,
77
64
  stopRun
@@ -79,12 +66,7 @@ function SubagentRunPanelProvider({ scopeKey, agentTools, selectedRunId, parentR
79
66
  agentTools,
80
67
  selectedRunId,
81
68
  parentRunning,
82
- open,
83
- hiddenCompleted,
84
- reportDisclosures,
85
- restoreFocusRunId,
86
- setOpen,
87
- setHiddenCompleted,
69
+ restoreFocus,
88
70
  commands,
89
71
  stopCurrentWork,
90
72
  stopRun
@@ -97,34 +79,28 @@ function SubagentRunPanelProvider({ scopeKey, agentTools, selectedRunId, parentR
97
79
  function useOptionalSubagentRunPanel() {
98
80
  return React.useContext(SubagentRunPanelContext);
99
81
  }
100
- function getSubagentRunRows(panel) {
101
- const runs = Object.values(panel.agentTools.runsById).sort((a, b) => Number(!agentToolRunMayExecute(a)) - Number(!agentToolRunMayExecute(b)) || a.order - b.order);
102
- return {
103
- runs,
104
- active: runs.filter(agentToolRunMayExecute),
105
- completed: runs.filter((run) => !agentToolRunMayExecute(run)),
106
- visible: runs.filter((run) => !panel.hiddenCompleted.has(run.runId) || agentToolRunMayExecute(run))
107
- };
82
+ /** Runs that may still execute lead; each group keeps dispatch order. */
83
+ function sortSubagentRuns(panel) {
84
+ return Object.values(panel.agentTools.runsById).sort((a, b) => Number(!agentToolRunMayExecute(a)) - Number(!agentToolRunMayExecute(b)) || a.order - b.order);
108
85
  }
109
- function useSubagentRunFocus(panel, visible) {
86
+ function useSubagentRunFocus(panel, runs) {
87
+ const triggerRef = React.useRef(null);
110
88
  const rootRef = React.useRef(null);
111
89
  const focusedControl = React.useRef(null);
112
90
  const [focusedOrder, setFocusedOrder] = React.useState(null);
113
91
  const ranks = focusedOrder ? new Map(focusedOrder.map((id, index) => [id, index])) : null;
114
- const ordered = ranks ? visible.toSorted((a, b) => (ranks.get(a.runId) ?? Infinity) - (ranks.get(b.runId) ?? Infinity)) : visible;
92
+ const ordered = ranks ? runs.toSorted((a, b) => (ranks.get(a.runId) ?? Infinity) - (ranks.get(b.runId) ?? Infinity)) : runs;
115
93
  React.useLayoutEffect(() => {
116
94
  const previous = focusedControl.current;
117
- if (!previous || previous.element.isConnected || document.activeElement !== document.body) return;
118
- (Array.from(rootRef.current?.querySelectorAll("[data-run-id]") ?? []).find((element) => element.dataset.runId === previous.runId)?.querySelector("a") ?? rootRef.current?.querySelector("[data-slot=\"subagent-run-panel-trigger\"]"))?.focus({ preventScroll: true });
95
+ const root = rootRef.current;
96
+ if (!previous || previous.element.isConnected || !root || document.activeElement !== document.body) return;
97
+ (Array.from(root.querySelectorAll("[data-run-id]")).find((element) => element.dataset.runId === previous.runId)?.querySelector("a") ?? root).focus({ preventScroll: true });
119
98
  });
120
99
  React.useEffect(() => {
121
- const focusId = panel.restoreFocusRunId.current;
122
- const root = rootRef.current;
123
- if (panel.selectedRunId || !root) return;
124
- if (!focusId) return;
125
- (Array.from(root.querySelectorAll("[data-run-id]")).find((element) => element.dataset.runId === focusId)?.querySelector("a") ?? root.querySelector("[data-slot=\"subagent-run-panel-trigger\"]"))?.focus({ preventScroll: true });
126
- panel.restoreFocusRunId.current = void 0;
127
- }, [panel.restoreFocusRunId, panel.selectedRunId]);
100
+ if (panel.selectedRunId || !panel.restoreFocus.current) return;
101
+ triggerRef.current?.focus({ preventScroll: true });
102
+ panel.restoreFocus.current = false;
103
+ }, [panel.restoreFocus, panel.selectedRunId]);
128
104
  const onFocusCapture = (event) => {
129
105
  focusedControl.current = {
130
106
  element: event.target,
@@ -139,25 +115,23 @@ function useSubagentRunFocus(panel, visible) {
139
115
  }
140
116
  };
141
117
  return {
118
+ triggerRef,
142
119
  rootRef,
143
120
  ordered,
144
121
  onFocusCapture,
145
122
  onBlurCapture
146
123
  };
147
124
  }
148
- function delegatedWorkLabel(active, completed) {
149
- const counts = [active ? `${active} active` : null, completed ? `${completed} finished` : null].filter(Boolean).join(", ");
150
- return `Delegated work${counts ? `, ${counts}` : ""}`;
151
- }
152
- function SubagentRunPanelControls({ panel, active }) {
125
+ function SubagentRunStopAll({ panel, active }) {
153
126
  const queue = useOptionalAgentChatQueue();
154
127
  const stop = panel.commands["current-work"] ?? IDLE;
155
- const canStop = panel.parentRunning || active > 1 || panel.agentTools.collection.status !== "ready";
156
- if (!canStop && !stop.error && !stop.pending) return null;
157
- return /* @__PURE__ */ jsx(QueueSectionActions, {
158
- "aria-label": "Delegated work controls",
159
- children: canStop || stop.error || stop.pending ? /* @__PURE__ */ jsx(Button, {
160
- size: "sm",
128
+ if (active < 2 && !stop.error && !stop.pending) return null;
129
+ return /* @__PURE__ */ jsx("div", {
130
+ className: "subagent-run__menu-header",
131
+ children: /* @__PURE__ */ jsx(IconButton, {
132
+ label: "Stop current work",
133
+ tooltip: stop.pending ? "Stopping current work…" : void 0,
134
+ size: "xs",
161
135
  variant: "ghost",
162
136
  color: "neutral",
163
137
  disabled: stop.pending,
@@ -167,8 +141,8 @@ function SubagentRunPanelControls({ panel, active }) {
167
141
  queue?.hold();
168
142
  panel.stopCurrentWork().catch(() => void 0);
169
143
  },
170
- children: stop.pending ? "Stopping current work…" : "Stop current work"
171
- }) : null
144
+ children: stop.pending ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : /* @__PURE__ */ jsx(SquareIcon, {})
145
+ })
172
146
  });
173
147
  }
174
148
  function SubagentRunRow({ panel, run, renderRunLink }) {
@@ -186,81 +160,118 @@ function SubagentRunRow({ panel, run, renderRunLink }) {
186
160
  children: command.error
187
161
  }) : null] }), actionable ? /* @__PURE__ */ jsx(QueueItemActions, {
188
162
  persistent: true,
189
- children: /* @__PURE__ */ jsx(QueueItemAction, {
163
+ children: /* @__PURE__ */ jsx(IconButton, {
164
+ label: `Stop ${getSubagentRunName(run)}`,
165
+ tooltip: command.pending ? "Stopping…" : void 0,
166
+ size: "xs",
167
+ variant: "ghost",
168
+ color: "neutral",
190
169
  disabled: command.pending,
191
170
  focusableWhenDisabled: true,
192
171
  "aria-busy": command.pending,
193
- "aria-label": `Stop ${getSubagentRunName(run)}`,
194
172
  onClick: () => {
195
173
  panel.stopRun(run.runId).catch(() => void 0);
196
174
  },
197
- children: command.pending ? "Stopping…" : "Stop"
175
+ children: command.pending ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : /* @__PURE__ */ jsx(SquareIcon, {})
198
176
  })
199
177
  }) : null]
200
178
  });
201
179
  }
202
180
  function SubagentRunPanelContent({ panel, renderRunLink }) {
203
- const { runs, active, completed, visible } = getSubagentRunRows(panel);
204
- const focus = useSubagentRunFocus(panel, visible);
181
+ const runs = sortSubagentRuns(panel);
182
+ const focus = useSubagentRunFocus(panel, runs);
205
183
  const stop = panel.commands["current-work"] ?? IDLE;
206
- if (!runs.length) return null;
207
- return /* @__PURE__ */ jsx(AgentChatPromptTray, {
184
+ const [open, setOpen] = React.useState(false);
185
+ const lead = runs.find((run) => run.status !== "completed") ?? runs[0];
186
+ if (!lead) {
187
+ if (open) setOpen(false);
188
+ return null;
189
+ }
190
+ const active = runs.filter(agentToolRunMayExecute).length;
191
+ const finished = runs.length - active;
192
+ const counts = [active && `${active} active`, finished && `${finished} finished`].filter(Boolean).join(", ");
193
+ const { collection } = panel.agentTools;
194
+ return /* @__PURE__ */ jsx("div", {
195
+ className: "subagent-run__dock",
208
196
  "data-subagent-run-panel": "",
209
- children: /* @__PURE__ */ jsx(Queue, {
210
- density: "compact",
211
- children: /* @__PURE__ */ jsxs(QueueSection, {
212
- ref: focus.rootRef,
213
- open: panel.open,
214
- onOpenChange: panel.setOpen,
215
- onFocusCapture: focus.onFocusCapture,
216
- onBlurCapture: focus.onBlurCapture,
217
- children: [/* @__PURE__ */ jsxs("div", {
218
- className: "subagent-run__panel-header",
219
- children: [/* @__PURE__ */ jsx(QueueSectionTrigger, {
197
+ children: /* @__PURE__ */ jsxs(Popover.Root, {
198
+ open,
199
+ onOpenChange: setOpen,
200
+ children: [/* @__PURE__ */ jsxs(Tooltip.Root, {
201
+ disabled: open,
202
+ children: [/* @__PURE__ */ jsxs(Tooltip.Trigger, {
203
+ render: /* @__PURE__ */ jsx(Popover.Trigger, {
204
+ unstyled: true,
205
+ ref: focus.triggerRef,
220
206
  "data-slot": "subagent-run-panel-trigger",
221
- "aria-label": delegatedWorkLabel(active.length, completed.length),
222
- children: /* @__PURE__ */ jsx(QueueSectionLabel, {
223
- count: runs.length || void 0,
224
- children: "Delegated work"
225
- })
226
- }), completed.length ? /* @__PURE__ */ jsx(Button, {
227
- className: "subagent-run__completed-toggle",
228
- size: "xs",
229
- variant: "ghost",
230
- color: "neutral",
231
- onClick: () => panel.setHiddenCompleted(panel.hiddenCompleted.size ? /* @__PURE__ */ new Set() : new Set(completed.map((run) => run.runId))),
232
- children: panel.hiddenCompleted.size ? `Show completed (${completed.length})` : "Hide completed"
233
- }) : null]
234
- }), /* @__PURE__ */ jsxs(QueueSectionContent, { children: [
235
- stop.error ? /* @__PURE__ */ jsx(AgentChatNotice, {
236
- "data-tone": "danger",
237
- role: "alert",
238
- children: stop.error
239
- }) : null,
240
- panel.agentTools.collection.status === "loading" ? /* @__PURE__ */ jsx(AgentChatNotice, { children: panel.agentTools.collection.stale ? "Reconnecting. Last known runs are shown." : "Loading delegated work…" }) : null,
241
- panel.agentTools.collection.status === "error" ? /* @__PURE__ */ jsx(AgentChatNotice, {
242
- "data-tone": "danger",
243
- role: "alert",
244
- children: panel.agentTools.collection.error ?? "Could not refresh delegated work. Last known runs are retained."
245
- }) : null,
246
- /* @__PURE__ */ jsx(QueueList, {
247
- "aria-label": "Delegated work runs",
248
- children: focus.ordered.map((run) => /* @__PURE__ */ jsx(SubagentRunRow, {
249
- panel,
250
- run,
251
- renderRunLink
252
- }, run.runId))
207
+ className: buttonVariants({
208
+ variant: "surface",
209
+ color: "neutral",
210
+ size: "xs",
211
+ className: "subagent-run__pill"
212
+ }),
213
+ "aria-description": counts
253
214
  }),
254
- /* @__PURE__ */ jsx(SubagentRunPanelControls, {
255
- panel,
256
- active: active.length
257
- })
258
- ] })]
259
- })
215
+ children: [/* @__PURE__ */ jsx(SubagentRunIndicator, { run: lead }), runs.length === 1 ? "1 agent" : `${runs.length} agents`]
216
+ }), /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
217
+ side: "top",
218
+ sideOffset: 6,
219
+ children: /* @__PURE__ */ jsxs(Tooltip.Popup, { children: ["Delegated work · ", counts] })
220
+ }) })]
221
+ }), /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(Popover.Positioner, {
222
+ side: "top",
223
+ align: "center",
224
+ sideOffset: 8,
225
+ children: /* @__PURE__ */ jsxs(Popover.Popup, {
226
+ ref: focus.rootRef,
227
+ "aria-label": "Delegated work",
228
+ className: "subagent-run__menu",
229
+ initialFocus: (openType) => openType === "keyboard" ? focus.rootRef.current?.querySelector("[data-run-id] a") ?? true : focus.rootRef.current,
230
+ onFocusCapture: focus.onFocusCapture,
231
+ onBlurCapture: focus.onBlurCapture,
232
+ children: [
233
+ /* @__PURE__ */ jsx(SubagentRunStopAll, {
234
+ panel,
235
+ active
236
+ }),
237
+ /* @__PURE__ */ jsxs("div", {
238
+ className: "subagent-run__notices",
239
+ children: [
240
+ stop.error ? /* @__PURE__ */ jsx(AgentChatNotice, {
241
+ "data-tone": "danger",
242
+ role: "alert",
243
+ children: stop.error
244
+ }) : null,
245
+ collection.status === "loading" ? /* @__PURE__ */ jsx(AgentChatNotice, { children: collection.stale ? "Reconnecting. Last known runs are shown." : "Loading delegated work…" }) : null,
246
+ collection.status === "error" ? /* @__PURE__ */ jsx(AgentChatNotice, {
247
+ "data-tone": "danger",
248
+ role: "alert",
249
+ children: collection.error ?? "Could not refresh delegated work. Last known runs are retained."
250
+ }) : null
251
+ ]
252
+ }),
253
+ /* @__PURE__ */ jsx(Queue, {
254
+ density: "compact",
255
+ children: /* @__PURE__ */ jsx(QueueList, {
256
+ "aria-label": "Delegated work runs",
257
+ children: focus.ordered.map((run) => /* @__PURE__ */ jsx(SubagentRunRow, {
258
+ panel,
259
+ run,
260
+ renderRunLink
261
+ }, run.runId))
262
+ })
263
+ })
264
+ ]
265
+ })
266
+ }) })]
260
267
  })
261
268
  });
262
269
  }
263
- /** Parent-scoped run queue composed beside queued prompts above the parent composer. */
270
+ /**
271
+ * Parent-scoped delegated work, collapsed to one pill above the composer — the
272
+ * shipped Codex "N background agents" row. The runs open in a popover on
273
+ * demand, so the dock never grows with the roster.
274
+ */
264
275
  function SubagentRunPanel({ renderRunLink }) {
265
276
  const panel = useOptionalSubagentRunPanel();
266
277
  return panel ? /* @__PURE__ */ jsx(SubagentRunPanelContent, {
@@ -1,8 +1,8 @@
1
1
  import { t as cx } from "../../class-names-BiMDVpUo.js";
2
2
  import { buttonVariants } from "../foundations/Button.js";
3
3
  import { Tooltip } from "../foundations/Tooltip.js";
4
- import { t as NavigationLink } from "../../navigation-link-kqMa81v5.js";
5
4
  import { SubagentRunLabel, getSubagentRunName, getSubagentRunStatusText } from "./SubagentRunIndicator.js";
5
+ import { t as NavigationLink } from "../../navigation-link-kqMa81v5.js";
6
6
  import "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  //#region src/components/agents-sdk/SubagentRunSelector.tsx
@@ -1,7 +1,7 @@
1
1
  import { J as PromptInputMessage } from "../../PromptInput-C3adKglc.js";
2
2
  import { i as AgentMessageRenderPartContext } from "../../AgentMessageParts-BtWwiE4f.js";
3
3
  import { AgentChatMessageContentProps, AgentChatRootProps } from "./AgentChat.js";
4
- import { o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, t as ThinkChatActivity } from "../../ThinkChatActivity-BkGjTY4r.js";
4
+ import { o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, t as ThinkChatActivity } from "../../ThinkChatActivity-C4_hPEmb.js";
5
5
  import { i as ThinkChatValue } from "../../ThinkChatContext-DQ6M2VlJ.js";
6
6
  import { n as WorkspaceFileRenderer } from "../../WorkspaceMessageResponse-D8FGgIQU.js";
7
7
  import * as React from "react";
@@ -7,7 +7,7 @@ import { n as WorkspaceMessageResponse, t as WorkspaceFileRendererProvider } fro
7
7
  import * as React from "react";
8
8
  import { jsx } from "react/jsx-runtime";
9
9
  import { isTextUIPart } from "ai";
10
- import { queryOptions, useQuery, useQueryClient } from "@tanstack/react-query";
10
+ import { queryOptions, replaceEqualDeep, useQuery, useQueryClient } from "@tanstack/react-query";
11
11
  //#region src/components/agents-sdk/ThinkChat.tsx
12
12
  const EMPTY_PENDING_APPROVALS = [];
13
13
  const STREAMED_TEXT_ANIMATION = {
@@ -129,10 +129,33 @@ function ThinkChatRoot({ chat, children, ...props }) {
129
129
  function normalizeThinkPrompt({ text, references }) {
130
130
  return parseComposerLinks(text).length ? composerDraftToPrompt(text) : [...references?.map(({ trigger, value }) => trigger ? `${trigger}${value}` : value) ?? [], text.trim()].filter(Boolean).join(" ");
131
131
  }
132
+ /**
133
+ * Agents' stream state assigns part fields in place and re-emits the same part
134
+ * objects, so the shared snapshot keeps its own shallow copies to compare against.
135
+ */
136
+ function detachParts(message) {
137
+ return {
138
+ ...message,
139
+ parts: message.parts.map((part) => ({ ...part }))
140
+ };
141
+ }
132
142
  /** Think activity/workspace rendering, independent of transcript layout and message actions. */
133
143
  function ThinkChatMessageContent({ message, renderPart, excludeTools, renderAgentToolRunLink, toolRenderers, renderWorkspaceFile }) {
144
+ const [snapshot, setSnapshot] = React.useState(() => ({
145
+ input: message,
146
+ shared: detachParts(message)
147
+ }));
148
+ let sharedMessage = snapshot.shared;
149
+ if (snapshot.input !== message) {
150
+ const detached = detachParts(message);
151
+ sharedMessage = snapshot.shared.id === message.id ? replaceEqualDeep(snapshot.shared, detached) : detached;
152
+ setSnapshot({
153
+ input: message,
154
+ shared: sharedMessage
155
+ });
156
+ }
134
157
  const { lastMessageId, status } = useAgentChatControls();
135
- const isLiveMessage = message.role === "assistant" && message.id === lastMessageId && status === "streaming";
158
+ const isLiveMessage = sharedMessage.role === "assistant" && sharedMessage.id === lastMessageId && status === "streaming";
136
159
  const activity = React.useMemo(() => createThinkChatActivityRenderer({
137
160
  excludeTools,
138
161
  renderAgentToolRunLink,
@@ -166,7 +189,7 @@ function ThinkChatMessageContent({ message, renderPart, excludeTools, renderAgen
166
189
  return /* @__PURE__ */ jsx(WorkspaceFileRendererProvider, {
167
190
  renderWorkspaceFile,
168
191
  children: /* @__PURE__ */ jsx(AgentChat.MessageContent, {
169
- message,
192
+ message: sharedMessage,
170
193
  renderPart: resolved
171
194
  })
172
195
  });
@@ -1,2 +1,2 @@
1
- import { a as ThinkChatToolRenderers, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as renderThinkChatActivityPart, t as ThinkChatActivity } from "../../ThinkChatActivity-BkGjTY4r.js";
1
+ import { a as ThinkChatToolRenderers, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as renderThinkChatActivityPart, t as ThinkChatActivity } from "../../ThinkChatActivity-C4_hPEmb.js";
2
2
  export { ThinkChatActivity, ThinkChatActivityProps, ThinkChatActivityRendererOptions, ThinkChatToolRenderer, ThinkChatToolRenderers, createThinkChatActivityRenderer, renderThinkChatActivityPart };