@mcp-b/react-components 0.44.1 → 0.46.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 (170) hide show
  1. package/dist/{AgentChat-Bibfj7u1.d.ts → AgentChat-BLmQghkt.d.ts} +2 -2
  2. package/dist/{AgentToolRunsContext-daY67hFM.d.ts → AgentToolRunsContext-jtmveaRE.d.ts} +8 -7
  3. package/dist/{CodeBlock-Dl7a3Wqo.js → CodeBlock-BpooTofO.js} +1 -1
  4. package/dist/{FileTree-Uu3ZnW1u.js → FileTree-CAXWXH63.js} +1 -1
  5. package/dist/{McpConnectorForm-MRm1r59e.d.ts → McpConnectorForm-BETdVBRk.d.ts} +1 -1
  6. package/dist/{McpPluginCatalog-mbGw8FTu.d.ts → McpPluginCatalog-C6ip9IvL.d.ts} +2 -2
  7. package/dist/{PromptInput-BRX7FhjH.d.ts → PromptInput-DtJHyp0S.d.ts} +27 -22
  8. package/dist/{ResponsiveSidebarShell-DOXd5T-d.d.ts → ResponsiveSidebarShell-BTVPxLJK.d.ts} +12 -0
  9. package/dist/{SetupChecklist-DOp-zqjh.js → SetupChecklist-DyPZWzK2.js} +2 -2
  10. package/dist/{ThinkChat-BES_3Mb-.js → ThinkChat-qztQ6Clo.js} +7 -22
  11. package/dist/{ThinkChatActivity-CgvmTXXB.d.ts → ThinkChatActivity-B3lGVS-6.d.ts} +1 -1
  12. package/dist/{WorkspaceFileView-BublZXky.js → WorkspaceFileView-BvDbKM2c.js} +3 -3
  13. package/dist/components/agents-sdk/AgentActivity.js +1 -1
  14. package/dist/components/agents-sdk/AgentChat.d.ts +1 -1
  15. package/dist/components/agents-sdk/AgentChat.js +44 -40
  16. package/dist/components/agents-sdk/AgentEvent.d.ts +42 -0
  17. package/dist/components/agents-sdk/AgentEvent.js +96 -0
  18. package/dist/components/agents-sdk/AgentToolRunsContext.d.ts +1 -1
  19. package/dist/components/agents-sdk/AgentToolRunsContext.js +11 -7
  20. package/dist/components/agents-sdk/BrowserLiveScreen.js +1 -1
  21. package/dist/components/agents-sdk/BrowserLiveView.js +1 -1
  22. package/dist/components/agents-sdk/BrowserReplay.js +2 -2
  23. package/dist/components/agents-sdk/BrowserRunPanel.js +1 -1
  24. package/dist/components/agents-sdk/ManagerOffice.d.ts +106 -11
  25. package/dist/components/agents-sdk/ManagerOffice.js +1193 -151
  26. package/dist/components/agents-sdk/McpConnectionRequest.d.ts +1 -1
  27. package/dist/components/agents-sdk/McpConnectionRequest.js +11 -5
  28. package/dist/components/agents-sdk/McpConnectorForm.d.ts +1 -1
  29. package/dist/components/agents-sdk/McpConnectorForm.js +1 -1
  30. package/dist/components/agents-sdk/McpPluginCatalog.d.ts +1 -1
  31. package/dist/components/agents-sdk/McpPluginCatalog.js +11 -7
  32. package/dist/components/agents-sdk/McpServerPicker.d.ts +2 -2
  33. package/dist/components/agents-sdk/McpServerPicker.js +4 -4
  34. package/dist/components/agents-sdk/ModelSelector.js +5 -5
  35. package/dist/components/agents-sdk/PromptInputApproval.js +1 -1
  36. package/dist/components/agents-sdk/PromptInputCommands.d.ts +5 -2
  37. package/dist/components/agents-sdk/PromptInputCommands.js +81 -3
  38. package/dist/components/agents-sdk/SubagentRunDetails.js +1 -1
  39. package/dist/components/agents-sdk/SubagentRunIndicator.d.ts +21 -3
  40. package/dist/components/agents-sdk/SubagentRunIndicator.js +56 -6
  41. package/dist/components/agents-sdk/SubagentRunSelector.js +5 -12
  42. package/dist/components/agents-sdk/ThinkChat.d.ts +4 -5
  43. package/dist/components/agents-sdk/ThinkChat.js +1 -1
  44. package/dist/components/agents-sdk/ThinkChatActivity.d.ts +1 -1
  45. package/dist/components/agents-sdk/ThinkChatActivity.js +3 -3
  46. package/dist/components/agents-sdk/ThinkChatActivitySummary.js +1 -1
  47. package/dist/components/agents-sdk/ThinkChatToolPanels.js +2 -2
  48. package/dist/components/agents-sdk/ThinkExecutionDetail.js +3 -3
  49. package/dist/components/agents-sdk/ThinkExecutionRun.js +1 -1
  50. package/dist/components/agents-sdk/ThinkExecutionStatus.js +1 -1
  51. package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +3 -3
  52. package/dist/components/agents-sdk/ThinkFullApp.d.ts +14 -4
  53. package/dist/components/agents-sdk/ThinkFullApp.js +51 -5
  54. package/dist/components/agents-sdk/ThinkFullAppViewSwitch.js +1 -1
  55. package/dist/components/agents-sdk/ThinkPendingApproval.js +1 -1
  56. package/dist/components/agents-sdk/ThinkRecoveryNotice.js +1 -1
  57. package/dist/components/agents-sdk/ThinkRoutineBrowser.js +3 -3
  58. package/dist/components/agents-sdk/ThinkRoutineDetail.js +1 -1
  59. package/dist/components/agents-sdk/ThinkRoutineForm.js +4 -4
  60. package/dist/components/agents-sdk/ThinkRoutineLibrary.d.ts +1 -1
  61. package/dist/components/agents-sdk/ThinkRoutineLibrary.js +4 -4
  62. package/dist/components/agents-sdk/ThinkRoutineRuns.js +1 -1
  63. package/dist/components/agents-sdk/ThinkSidepanel.d.ts +22 -4
  64. package/dist/components/agents-sdk/ThinkSidepanel.js +87 -35
  65. package/dist/components/agents-sdk/ThinkThreadPicker.js +5 -5
  66. package/dist/components/agents-sdk/Workspace.js +1 -1
  67. package/dist/components/agents-sdk/WorkspaceBrowser.js +1 -1
  68. package/dist/components/agents-sdk/WorkspaceExplorer.js +1 -1
  69. package/dist/components/agents-sdk/WorkspaceFileView.js +1 -1
  70. package/dist/components/agents-sdk/WorkspaceHeader.js +1 -1
  71. package/dist/components/agents-sdk/WorkspaceMountManager.js +4 -21
  72. package/dist/components/ai-sdk/Activity.js +1 -1
  73. package/dist/components/ai-sdk/AgentChatStartScreen.js +1 -1
  74. package/dist/components/ai-sdk/Approval.js +2 -2
  75. package/dist/components/ai-sdk/Artifact.js +1 -1
  76. package/dist/components/ai-sdk/ChainOfThought.d.ts +1 -1
  77. package/dist/components/ai-sdk/ChainOfThought.js +1 -1
  78. package/dist/components/ai-sdk/Checkpoint.js +1 -1
  79. package/dist/components/ai-sdk/CodeBlock.js +1 -1
  80. package/dist/components/ai-sdk/ComposerLink.d.ts +27 -0
  81. package/dist/components/ai-sdk/ComposerLink.js +111 -0
  82. package/dist/components/ai-sdk/ConnectedAppCards.js +3 -3
  83. package/dist/components/ai-sdk/Context.js +1 -1
  84. package/dist/components/ai-sdk/Conversation.js +1 -1
  85. package/dist/components/ai-sdk/Goal.js +2 -2
  86. package/dist/components/ai-sdk/InlineCitation.js +1 -1
  87. package/dist/components/ai-sdk/MediaPreviewCard.js +1 -1
  88. package/dist/components/ai-sdk/Message.js +19 -3
  89. package/dist/components/ai-sdk/MessageScroller.js +1 -1
  90. package/dist/components/ai-sdk/MessageScrollerVirtual.js +1 -1
  91. package/dist/components/ai-sdk/Plan.js +2 -2
  92. package/dist/components/ai-sdk/PromptInput.d.ts +2 -2
  93. package/dist/components/ai-sdk/PromptInput.js +67 -61
  94. package/dist/components/ai-sdk/PromptInputComposerEditor.d.ts +31 -0
  95. package/dist/components/ai-sdk/PromptInputComposerEditor.js +198 -0
  96. package/dist/components/ai-sdk/Queue.js +2 -2
  97. package/dist/components/ai-sdk/Reasoning.js +2 -2
  98. package/dist/components/ai-sdk/Sources.js +1 -1
  99. package/dist/components/ai-sdk/Task.js +1 -1
  100. package/dist/components/ai-sdk/ToolInvocation.js +1 -1
  101. package/dist/components/extension/ChatGptSignInScreen.js +2 -2
  102. package/dist/components/extension/CodexModelSelector.js +2 -2
  103. package/dist/components/extension/ConversationTabPicker.js +2 -2
  104. package/dist/components/foundations/AppIcon.js +1 -1
  105. package/dist/components/foundations/Checkbox.js +1 -1
  106. package/dist/components/foundations/Collapsible.js +1 -1
  107. package/dist/components/foundations/ContextMenu.js +1 -1
  108. package/dist/components/foundations/Menubar.js +1 -1
  109. package/dist/components/foundations/SearchField.js +1 -1
  110. package/dist/components/foundations/Select.js +1 -1
  111. package/dist/components/foundations/Stepper.js +1 -1
  112. package/dist/components/foundations/Toast.js +1 -1
  113. package/dist/components/foundations/ToggleGroup.d.ts +1 -1
  114. package/dist/components/foundations/ToggleGroup.js +1 -1
  115. package/dist/components/foundations/icons.d.ts +1 -1
  116. package/dist/components/foundations/icons.js +1 -1
  117. package/dist/components/general-purpose/Commit.js +2 -2
  118. package/dist/components/general-purpose/EnvironmentVariables.js +2 -2
  119. package/dist/components/general-purpose/FileTree.js +1 -1
  120. package/dist/components/general-purpose/PricingBillingToggle.js +1 -1
  121. package/dist/components/general-purpose/PricingPlanCard.js +2 -2
  122. package/dist/components/general-purpose/PricingUsageCalculator.js +2 -2
  123. package/dist/components/general-purpose/ResizableSidePanel.js +1 -1
  124. package/dist/components/general-purpose/ResponsiveSidebarShell.d.ts +1 -1
  125. package/dist/components/general-purpose/ResponsiveSidebarShell.js +72 -22
  126. package/dist/components/general-purpose/SettingsFormDialog.js +2 -2
  127. package/dist/components/general-purpose/SetupChecklist.js +1 -1
  128. package/dist/components/general-purpose/Terminal.js +2 -2
  129. package/dist/components/general-purpose/TestResults.js +1 -1
  130. package/dist/components/general-purpose/ThemeModeControl.js +2 -2
  131. package/dist/components/general-purpose/WebPreview.js +3 -3
  132. package/dist/components/nanites/AgentConnection.js +2 -2
  133. package/dist/components/nanites/AgentToolDetail.js +4 -4
  134. package/dist/{copy-button-DHhf-J1d.js → copy-button-D7ySsRRo.js} +1 -1
  135. package/dist/{format-DB2mX9DA.js → format-COCyV98Z.js} +23 -1
  136. package/dist/{icons-Dw-im7lg.js → icons-BNEY4gO5.js} +44 -4
  137. package/dist/{icons-6ZnyZJiR.d.ts → icons-D0Pd2P9v.d.ts} +9 -4
  138. package/dist/{mcp-server-SD_S-IpB.js → mcp-server-7NR24ASj.js} +31 -4
  139. package/dist/{mcp-server-catalog-CCj2ItkV.d.ts → mcp-server-catalog-Cbu483Zb.d.ts} +9 -9
  140. package/dist/{progress-ring-BEocM1e3.js → progress-ring-Cgii90dC.js} +1 -1
  141. package/dist/{provider-logos-zjZycgV6.js → provider-logos-DWYY8wNz.js} +31 -6
  142. package/dist/styles/action-guide.css +4 -0
  143. package/dist/styles/agent-attention.css +5 -1
  144. package/dist/styles/agent-chat.css +21 -18
  145. package/dist/styles/agent-event.css +14 -0
  146. package/dist/styles/app-icon.css +21 -0
  147. package/dist/styles/avatar.css +2 -1
  148. package/dist/styles/base.css +4 -0
  149. package/dist/styles/brand-marks.css +22 -0
  150. package/dist/styles/button.css +10 -0
  151. package/dist/styles/composer-link.css +99 -0
  152. package/dist/styles/connected-app-card.css +9 -0
  153. package/dist/styles/github-motion-mark.css +8 -1
  154. package/dist/styles/index.css +3 -0
  155. package/dist/styles/manager-office.css +1313 -73
  156. package/dist/styles/mcp-plugin-catalog.css +4 -0
  157. package/dist/styles/mcp-server-picker.css +2 -0
  158. package/dist/styles/message-scroller.css +5 -0
  159. package/dist/styles/prompt-input.css +14 -53
  160. package/dist/styles/responsive-sidebar-shell.css +47 -0
  161. package/dist/styles/subagent-run.css +29 -19
  162. package/dist/styles/think-full-app.css +139 -4
  163. package/dist/styles/think-sidepanel.css +9 -5
  164. package/dist/styles/think-thread-picker.css +13 -12
  165. package/dist/styles/workspace-mount-manager.css +0 -22
  166. package/dist/utils/composer-link.d.ts +59 -0
  167. package/dist/utils/composer-link.js +203 -0
  168. package/dist/utils/mcp-server-catalog.d.ts +1 -1
  169. package/dist/utils/mcp-server-catalog.js +9 -9
  170. package/package.json +8 -8
@@ -1,6 +1,6 @@
1
1
  import { i as AgentMessageRenderPartContext } from "./AgentMessageParts-C7L-Mv9U.js";
2
2
  import { n as AgentChatStartScreenProps } from "./AgentChatStartScreen-Bkv7Avni.js";
3
- import { D as PromptInputCommandDefinition, F as PromptInputDictationProps, K as PromptInputMessage, M as PromptInputContextSelectorProps, Q as PromptInputReference, n as PermissionMode } from "./PromptInput-BRX7FhjH.js";
3
+ import { D as PromptInputCommandDefinition, F as PromptInputDictationProps, K as PromptInputMessage, M as PromptInputContextSelectorProps, Q as PromptInputReference, n as PermissionMode } from "./PromptInput-DtJHyp0S.js";
4
4
  import * as React from "react";
5
5
  import { ChatAddToolApproveResponseFunction, ChatStatus, UIMessage } from "ai";
6
6
  import { PendingApproval, Think } from "@cloudflare/think";
@@ -138,7 +138,7 @@ interface AgentChatProps<MessageT extends UIMessage = UIMessage> {
138
138
  onCompact?: () => Promise<{
139
139
  compacted: boolean;
140
140
  }>;
141
- /** Controlled MCP catalog revealed by `@`; selections become composer references. */
141
+ /** Controlled MCP or tab catalog revealed by `@`; selections become composer links. */
142
142
  mentionCommands?: {
143
143
  items: readonly PromptInputCommandDefinition[];
144
144
  onSelect?: (command: PromptInputCommandDefinition, draft: AgentChatComposerDraft) => void;
@@ -25,13 +25,14 @@ type AgentToolEventSource = Parameters<typeof useAgentToolEvents>[0]["agent"] &
25
25
  * The subscription's listener attaches in a passive effect, after paint. A
26
26
  * host whose transport is in-process (the browser extension's port bridge)
27
27
  * can complete the connect and deliver the replay before that effect runs —
28
- * reliably so on a hot return from a drill-in. Upstream owns the fix:
29
- * `useAgent` buffers `agent-tool-event` frames from socket construction and
30
- * `useAgentToolEvents` drains them when its listener attaches (agents >
31
- * 0.20.1; `_bufferAgentToolReplayFrame` is the seam for a non-`useAgent`
32
- * socket). On older versions such hosts must buffer and re-dispatch
33
- * themselves think-browser-host's `useThinkAgentToolEvents` is that
34
- * interim shim. Network transports are not affected in practice: the round
28
+ * reliably so on a hot return from a drill-in. The fix lives in the Agents
29
+ * SDK, not here: `useAgent` buffers `agent-tool-event` frames from socket
30
+ * construction and `useAgentToolEvents` drains them when its listener
31
+ * attaches (`_bufferAgentToolReplayFrame` is the seam for a non-`useAgent`
32
+ * socket). As of agents 0.21.0 that is still the browser host's vendored
33
+ * edit, not a published release; a host on the published package has to
34
+ * buffer and re-dispatch the frames around its own socket before this hook
35
+ * can see them. Network transports are not affected in practice: the round
35
36
  * trip loses to the effect flush.
36
37
  */
37
38
  declare function useSourceScopedAgentToolEvents<Part extends AgentToolRunPart = UIMessage["parts"][number]>(agent: AgentToolEventSource): {
@@ -1,6 +1,6 @@
1
1
  import { t as cx } from "./class-names-BiMDVpUo.js";
2
- import { t as CopyButton } from "./copy-button-DHhf-J1d.js";
3
2
  import { Select } from "./components/foundations/Select.js";
3
+ import { t as CopyButton } from "./copy-button-D7ySsRRo.js";
4
4
  import * as React from "react";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { createHighlighter } from "shiki";
@@ -1,5 +1,5 @@
1
1
  import { t as cx } from "./class-names-BiMDVpUo.js";
2
- import { C as FolderIcon, S as FileIcon, p as ChevronRightIcon, w as FolderOpenIcon } from "./icons-Dw-im7lg.js";
2
+ import { C as FolderIcon, S as FileIcon, p as ChevronRightIcon, w as FolderOpenIcon } from "./icons-BNEY4gO5.js";
3
3
  import { t as NavigationLink } from "./navigation-link-kqMa81v5.js";
4
4
  import * as React from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,4 +1,4 @@
1
- import { d as McpServerSetupAuthFieldName, l as McpServerSetupAuth } from "./mcp-server-catalog-CCj2ItkV.js";
1
+ import { d as McpServerSetupAuthFieldName, l as McpServerSetupAuth } from "./mcp-server-catalog-Cbu483Zb.js";
2
2
  import * as React from "react";
3
3
 
4
4
  //#region src/components/agents-sdk/McpConnectorForm.d.ts
@@ -1,5 +1,5 @@
1
- import { o as McpServerCard } from "./mcp-server-catalog-CCj2ItkV.js";
2
- import { r as McpConnectorFormValues } from "./McpConnectorForm-MRm1r59e.js";
1
+ import { o as McpServerCard } from "./mcp-server-catalog-Cbu483Zb.js";
2
+ import { r as McpConnectorFormValues } from "./McpConnectorForm-BETdVBRk.js";
3
3
  import { l as DialogProps } from "./Dialog-B_FhRWaz.js";
4
4
  import * as React from "react";
5
5
  import { MCPServersState } from "agents";
@@ -442,13 +442,20 @@ declare function PromptInputTabLabel({
442
442
  }: PromptInputTabLabelProps & {
443
443
  ref?: React.Ref<HTMLHeadingElement>;
444
444
  }): React.JSX.Element;
445
- interface PromptInputTabItemProps extends React.HTMLAttributes<HTMLDivElement> {}
445
+ interface PromptInputTabItemProps extends React.HTMLAttributes<HTMLElement> {
446
+ /** When set, the row is a composer entity link rather than a static tab row. */
447
+ href?: string;
448
+ icon?: React.ReactNode;
449
+ }
446
450
  declare function PromptInputTabItem({
447
451
  className,
452
+ href,
453
+ icon,
454
+ children,
448
455
  ref,
449
456
  ...props
450
457
  }: PromptInputTabItemProps & {
451
- ref?: React.Ref<HTMLDivElement>;
458
+ ref?: React.Ref<HTMLElement>;
452
459
  }): React.JSX.Element;
453
460
  interface PromptInputCommandDefinition {
454
461
  /** Stable identity for keyed rendering. */
@@ -458,6 +465,10 @@ interface PromptInputCommandDefinition {
458
465
  label: string;
459
466
  description?: string;
460
467
  icon?: React.ReactNode;
468
+ /** Persistable mark used when the command is inserted as a composer link. */
469
+ iconSrc?: string;
470
+ /** Optional explicit composer href. Derived from the trigger when omitted. */
471
+ href?: string;
461
472
  keywords?: readonly string[];
462
473
  disabled?: boolean;
463
474
  group?: string;
@@ -470,12 +481,15 @@ interface PromptInputReference {
470
481
  value: string;
471
482
  label: string;
472
483
  icon?: React.ReactNode;
484
+ iconSrc?: string;
485
+ href?: string;
473
486
  /** Records which picker produced the reference. */
474
487
  trigger?: PromptInputCommandTrigger;
475
488
  }
489
+ declare function composerLinksToReferences(text: string): PromptInputReference[];
476
490
  interface PromptInputCommandComposerProps extends Omit<PromptInputTextareaProps, "value" | "defaultValue" | "onChange"> {
477
491
  commands: readonly PromptInputCommandDefinition[];
478
- /** MCP or other mentionable entries revealed by an `@` draft. */
492
+ /** MCP, tab, or other mentionable entries revealed by an `@` draft. */
479
493
  mentionCommands?: readonly PromptInputCommandDefinition[];
480
494
  value: string;
481
495
  onValueChange: (value: string) => void;
@@ -484,8 +498,8 @@ interface PromptInputCommandComposerProps extends Omit<PromptInputTextareaProps,
484
498
  mentionEmptyMessage?: React.ReactNode;
485
499
  }
486
500
  /**
487
- * Controlled PromptInput textarea with slash-command discovery. The host owns
488
- * both the command catalog and the draft policy applied after selection.
501
+ * Controlled composer field with slash-command and mention discovery.
502
+ * Selection inserts a special href into the draft not a chip button.
489
503
  */
490
504
  declare function PromptInputCommandComposer({
491
505
  commands,
@@ -497,24 +511,15 @@ declare function PromptInputCommandComposer({
497
511
  mentionEmptyMessage,
498
512
  onKeyDown,
499
513
  ref,
500
- ...textareaProps
501
- }: PromptInputCommandComposerProps & {
502
- ref?: React.Ref<HTMLTextAreaElement>;
503
- }): React.JSX.Element;
504
- interface PromptInputReferencesProps extends React.HTMLAttributes<HTMLDivElement> {
505
- references: readonly PromptInputReference[];
506
- onRemove: (reference: PromptInputReference) => void;
507
- }
508
- /** Removable inline context selected from slash-command or mention pickers. */
509
- declare function PromptInputReferences({
510
- references,
511
- onRemove,
514
+ placeholder,
515
+ disabled,
512
516
  className,
513
- ref,
514
- ...props
515
- }: PromptInputReferencesProps & {
517
+ minHeight,
518
+ maxHeight,
519
+ "aria-label": ariaLabel
520
+ }: PromptInputCommandComposerProps & {
516
521
  ref?: React.Ref<HTMLDivElement>;
517
- }): React.JSX.Element | null;
522
+ }): React.JSX.Element;
518
523
  interface PromptInputContextItem {
519
524
  /** Exact host identifier or path preserved through selection. */
520
525
  value: string;
@@ -545,4 +550,4 @@ declare function PromptInputContextSelector({
545
550
  action
546
551
  }: PromptInputContextSelectorProps): React.JSX.Element;
547
552
  //#endregion
548
- export { PromptInputReferences as $, PromptInputContextItem as A, PromptInputHoverCard as B, PromptInputButtonProps as C, usePromptInputAttachments as Ct, PromptInputCommandDefinition as D, PromptInputCommandComposerProps as E, PromptInputDictationProps as F, PromptInputHoverCardTriggerProps as G, PromptInputHoverCardContentProps as H, PromptInputFooter as I, PromptInputPermissionSelectorProps as J, PromptInputMessage as K, PromptInputFooterProps as L, PromptInputContextSelectorProps as M, PromptInputControllerProps as N, PromptInputCommandTrigger as O, PromptInputDictation as P, PromptInputReference as Q, PromptInputHeader as R, PromptInputButton as S, TooltipSide as St, PromptInputCommandComposer as T, useProviderAttachments as Tt, PromptInputHoverCardProps as U, PromptInputHoverCardContent as V, PromptInputHoverCardTrigger as W, PromptInputProvider as X, PromptInputProps as Y, PromptInputProviderProps as Z, PromptInputAttachmentProps as _, PromptInputTooltipConfig as _t, PromptInputActionAddAttachmentsProps as a, PromptInputTabBodyProps as at, PromptInputBody as b, PromptInputVoiceInput as bt, PromptInputActionMenu as c, PromptInputTabLabel as ct, PromptInputActionMenuItem as d, PromptInputTabsList as dt, PromptInputReferencesProps as et, PromptInputActionMenuItemProps as f, PromptInputTabsListProps as ft, PromptInputAttachment as g, PromptInputToolsProps as gt, PromptInputActionMenuTriggerProps as h, PromptInputTools as ht, PromptInputActionAddAttachments as i, PromptInputTabBody as it, PromptInputContextSelector as j, PromptInputContextAction as k, PromptInputActionMenuContent as l, PromptInputTabLabelProps as lt, PromptInputActionMenuTrigger as m, PromptInputTextareaProps as mt, PermissionMode as n, PromptInputSubmitProps as nt, PromptInputActionAddScreenshot as o, PromptInputTabItem as ot, PromptInputActionMenuProps as p, PromptInputTextarea as pt, PromptInputPermissionSelector as q, PromptInput as r, PromptInputTab as rt, PromptInputActionAddScreenshotProps as s, PromptInputTabItemProps as st, AttachmentsContext as t, PromptInputSubmit as tt, PromptInputActionMenuContentProps as u, PromptInputTabProps as ut, PromptInputAttachments as v, PromptInputTray as vt, PromptInputButtonTooltip as w, usePromptInputController as wt, PromptInputBodyProps as x, TextInputContext as xt, PromptInputAttachmentsProps as y, PromptInputTrayProps as yt, PromptInputHeaderProps as z };
553
+ export { PromptInputSubmit as $, PromptInputContextItem as A, PromptInputHoverCard as B, PromptInputButtonProps as C, usePromptInputController as Ct, PromptInputCommandDefinition as D, PromptInputCommandComposerProps as E, PromptInputDictationProps as F, PromptInputHoverCardTriggerProps as G, PromptInputHoverCardContentProps as H, PromptInputFooter as I, PromptInputPermissionSelectorProps as J, PromptInputMessage as K, PromptInputFooterProps as L, PromptInputContextSelectorProps as M, PromptInputControllerProps as N, PromptInputCommandTrigger as O, PromptInputDictation as P, PromptInputReference as Q, PromptInputHeader as R, PromptInputButton as S, usePromptInputAttachments as St, PromptInputCommandComposer as T, PromptInputHoverCardProps as U, PromptInputHoverCardContent as V, PromptInputHoverCardTrigger as W, PromptInputProvider as X, PromptInputProps as Y, PromptInputProviderProps as Z, PromptInputAttachmentProps as _, PromptInputTrayProps as _t, PromptInputActionAddAttachmentsProps as a, PromptInputTabItemProps as at, PromptInputBody as b, TooltipSide as bt, PromptInputActionMenu as c, PromptInputTabProps as ct, PromptInputActionMenuItem as d, PromptInputTextarea as dt, PromptInputSubmitProps as et, PromptInputActionMenuItemProps as f, PromptInputTextareaProps as ft, PromptInputAttachment as g, PromptInputTray as gt, PromptInputActionMenuTriggerProps as h, PromptInputTooltipConfig as ht, PromptInputActionAddAttachments as i, PromptInputTabItem as it, PromptInputContextSelector as j, PromptInputContextAction as k, PromptInputActionMenuContent as l, PromptInputTabsList as lt, PromptInputActionMenuTrigger as m, PromptInputToolsProps as mt, PermissionMode as n, PromptInputTabBody as nt, PromptInputActionAddScreenshot as o, PromptInputTabLabel as ot, PromptInputActionMenuProps as p, PromptInputTools as pt, PromptInputPermissionSelector as q, PromptInput as r, PromptInputTabBodyProps as rt, PromptInputActionAddScreenshotProps as s, PromptInputTabLabelProps as st, AttachmentsContext as t, PromptInputTab as tt, PromptInputActionMenuContentProps as u, PromptInputTabsListProps as ut, PromptInputAttachments as v, PromptInputVoiceInput as vt, PromptInputButtonTooltip as w, useProviderAttachments as wt, PromptInputBodyProps as x, composerLinksToReferences as xt, PromptInputAttachmentsProps as y, TextInputContext as yt, PromptInputHeaderProps as z };
@@ -72,6 +72,14 @@ interface ResponsiveSidebarShellProps extends Omit<React.HTMLAttributes<HTMLDivE
72
72
  children?: React.ReactNode;
73
73
  /** Short noun used by the toggle and resize control, such as “threads” or “schedules”. */
74
74
  sidebarLabel?: string;
75
+ /** Whether the sidebar is open. Omit for internal state. */
76
+ sidebarOpen?: boolean;
77
+ /** Move the wide-layout toggle into the sidebar while it is open. */
78
+ sidebarTogglePlacement?: "main" | "sidebar";
79
+ /** Initial sidebar state when `sidebarOpen` is uncontrolled. */
80
+ defaultSidebarOpen?: boolean;
81
+ /** Called when the sidebar is opened or closed. */
82
+ onSidebarOpenChange?: (open: boolean) => void;
75
83
  /** Initial desktop sidebar width in CSS pixels. */
76
84
  defaultSidebarWidth?: number;
77
85
  /** Shell-owned application bar composed from slots. */
@@ -95,7 +103,11 @@ interface ResponsiveSidebarShellProps extends Omit<React.HTMLAttributes<HTMLDivE
95
103
  declare function ResponsiveSidebarShell({
96
104
  sidebar,
97
105
  sidebarLabel,
106
+ sidebarOpen,
107
+ sidebarTogglePlacement,
108
+ defaultSidebarOpen,
98
109
  defaultSidebarWidth,
110
+ onSidebarOpenChange,
99
111
  bar,
100
112
  error,
101
113
  showMainLabel,
@@ -1,5 +1,5 @@
1
1
  import { n as mergeBaseClassName } from "./class-names-BiMDVpUo.js";
2
- import { V as PlusIcon, d as CheckIcon, et as WarningIcon, f as ChevronDownIcon } from "./icons-Dw-im7lg.js";
2
+ import { V as PlusIcon, d as CheckIcon, et as WarningIcon, f as ChevronDownIcon } from "./icons-BNEY4gO5.js";
3
3
  import { Button } from "./components/foundations/Button.js";
4
4
  import { Menu } from "./components/foundations/Menu.js";
5
5
  import * as React from "react";
@@ -57,7 +57,7 @@ function SetupChecklistAction({ actionLabel, label, entries, onSelect }) {
57
57
  type: "button",
58
58
  variant: "ghost",
59
59
  color: "neutral",
60
- size: "md",
60
+ size: "sm",
61
61
  "aria-label": `${actionLabel} — ${completed} of ${entries.length} set up`,
62
62
  render: /* @__PURE__ */ jsx(Menu.Trigger, { unstyled: true }),
63
63
  children: [completed === entries.length ? /* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(WarningIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", { children: actionLabel })]
@@ -1,13 +1,13 @@
1
+ import { composerDraftToPrompt, parseComposerLinks } from "./utils/composer-link.js";
1
2
  import { TransitionSurface } from "./components/foundations/TransitionSurface.js";
3
+ import { AgentToolRunsProvider, useSourceScopedAgentToolEvents } from "./components/agents-sdk/AgentToolRunsContext.js";
2
4
  import { AgentChat, compactingNotice } from "./components/agents-sdk/AgentChat.js";
3
- import { AgentToolRunsProvider, useOptionalAgentToolRuns, useSourceScopedAgentToolEvents } from "./components/agents-sdk/AgentToolRunsContext.js";
4
- import { SubagentRunList } from "./components/agents-sdk/SubagentRunList.js";
5
5
  import { ThinkChatContext, ThinkChatLiveContext, useOptionalThinkChatContext, useThinkChatContext } from "./components/agents-sdk/ThinkChatContext.js";
6
6
  import { ThinkChatActivity, createThinkChatActivityRenderer, renderThinkChatActivityPart } from "./components/agents-sdk/ThinkChatActivity.js";
7
7
  import { ThinkRecoveryNotice } from "./components/agents-sdk/ThinkRecoveryNotice.js";
8
8
  import { t as WorkspaceMessageResponse } from "./WorkspaceMessageResponse-CJCmGvTx.js";
9
9
  import * as React from "react";
10
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
11
  import { isTextUIPart } from "ai";
12
12
  import { useAgentChat } from "@cloudflare/think/react";
13
13
  import { useAgent } from "agents/react";
@@ -195,9 +195,8 @@ const ThinkChatApprovalsContext = React.createContext(null);
195
195
  * inside the log) or `excludeTools` + your own `renderPart` (standalone
196
196
  * card) — see README "App-specific tools" and the Custom Tool Panel story.
197
197
  */
198
- function ThinkChatMessages({ composerHeader, draft, loading, renderPart, excludeTools, renderAgentToolRunLink, renderWorkspaceHtmlArtifact, toolRenderers, thinkStub, onExecutionSettled, pendingApprovals, notice, sessionCompaction, ...props }) {
198
+ function ThinkChatMessages({ draft, loading, renderPart, excludeTools, renderAgentToolRunLink, renderWorkspaceHtmlArtifact, toolRenderers, thinkStub, onExecutionSettled, pendingApprovals, notice, sessionCompaction, ...props }) {
199
199
  const chat = useOptionalThinkChatContext();
200
- const agentTools = useOptionalAgentToolRuns();
201
200
  const approvals = React.useContext(ThinkChatApprovalsContext);
202
201
  const resolvedApprovals = resolveThinkApprovalProps({
203
202
  thinkStub,
@@ -259,22 +258,11 @@ function ThinkChatMessages({ composerHeader, draft, loading, renderPart, exclude
259
258
  children: [compactionSizeText(landedCompaction), " Context usage updates after your next message."]
260
259
  }) : null;
261
260
  const recoveryActive = chat && (chat.isRecovering || chat.connectionError || chat.error);
262
- const backgroundRuns = renderAgentToolRunLink ? agentTools?.unboundRuns : void 0;
263
- const resolvedComposerHeader = composerHeader || backgroundRuns?.length ? /* @__PURE__ */ jsxs(Fragment, { children: [composerHeader, backgroundRuns?.length && renderAgentToolRunLink ? /* @__PURE__ */ jsxs("div", {
264
- className: "subagent-run__tray",
265
- "data-slot": "background-agent-runs",
266
- children: [/* @__PURE__ */ jsx("span", {
267
- className: "subagent-run__tray-label",
268
- children: "Background agents"
269
- }), /* @__PURE__ */ jsx(SubagentRunList, {
270
- "aria-label": "Background agent runs",
271
- runs: backgroundRuns,
272
- renderRunLink: renderAgentToolRunLink
273
- })]
274
- }) : null] }) : void 0;
275
261
  const submit = ({ text, files, references }, send) => {
276
262
  setDismissedCompaction(sessionCompaction?.lastCompaction ?? null);
277
- const prompt = [...references?.map(({ trigger, value }) => trigger ? `${trigger}${value}` : value) ?? [], text.trim()].filter(Boolean).join(" ");
263
+ const fromLinks = composerDraftToPrompt(text);
264
+ const referenceTokens = references?.map(({ trigger, value }) => trigger ? `${trigger}${value}` : value) ?? [];
265
+ const prompt = parseComposerLinks(text).length ? fromLinks : [...referenceTokens, text.trim()].filter(Boolean).join(" ");
278
266
  if (!prompt && !files.length) return;
279
267
  return send({
280
268
  text: prompt,
@@ -288,7 +276,6 @@ function ThinkChatMessages({ composerHeader, draft, loading, renderPart, exclude
288
276
  messages: EMPTY_DRAFT_MESSAGES,
289
277
  status: "ready",
290
278
  notice,
291
- composerHeader: resolvedComposerHeader,
292
279
  loading: true
293
280
  });
294
281
  if (!chat) {
@@ -299,7 +286,6 @@ function ThinkChatMessages({ composerHeader, draft, loading, renderPart, exclude
299
286
  messages: draft.messages ?? EMPTY_DRAFT_MESSAGES,
300
287
  status: draft.status ?? "ready",
301
288
  notice: notice ?? sessionCompactionNotice,
302
- composerHeader: resolvedComposerHeader,
303
289
  onSubmit: (message) => submit(message, draft.onSubmit)
304
290
  });
305
291
  }
@@ -314,7 +300,6 @@ function ThinkChatMessages({ composerHeader, draft, loading, renderPart, exclude
314
300
  onExecutionSettled: resolvedApprovals.onExecutionSettled,
315
301
  pendingApprovals: resolvedApprovals.pendingApprovals,
316
302
  notice: notice ?? (recoveryActive ? defaultNotice : sessionCompactionNotice),
317
- composerHeader: resolvedComposerHeader,
318
303
  onRegenerate: (messageId) => void chat.regenerate({ messageId }),
319
304
  onSubmit: (message) => submit(message, chat.sendMessage)
320
305
  });
@@ -1,5 +1,5 @@
1
1
  import { i as AgentMessageRenderPartContext } from "./AgentMessageParts-C7L-Mv9U.js";
2
- import { r as AgentChatProps } from "./AgentChat-Bibfj7u1.js";
2
+ import { r as AgentChatProps } from "./AgentChat-BLmQghkt.js";
3
3
  import { l as ThinkChatPart } from "./ThinkChatToolParts-D4qcnnxt.js";
4
4
  import { t as ThinkChatActivityDescription } from "./ThinkChatActivitySummary-BtBQgMg6.js";
5
5
  import * as React from "react";
@@ -1,7 +1,7 @@
1
- import { b as EyeIcon, d as CheckIcon, et as WarningIcon, k as MaximizeIcon, m as CodeIcon, r as ArrowLeftIcon, v as DownloadIcon } from "./icons-Dw-im7lg.js";
2
- import { r as formatClock } from "./format-DB2mX9DA.js";
1
+ import { b as EyeIcon, d as CheckIcon, et as WarningIcon, k as MaximizeIcon, m as CodeIcon, r as ArrowLeftIcon, v as DownloadIcon } from "./icons-BNEY4gO5.js";
2
+ import { i as formatClock } from "./format-COCyV98Z.js";
3
+ import { a as CodeBlockCopyButton, i as CodeBlockContent, r as CodeBlockContainer, t as CodeBlock } from "./CodeBlock-BpooTofO.js";
3
4
  import { AppTopBar } from "./components/general-purpose/AppTopBar.js";
4
- import { a as CodeBlockCopyButton, i as CodeBlockContent, r as CodeBlockContainer, t as CodeBlock } from "./CodeBlock-Dl7a3Wqo.js";
5
5
  import { inferWorkspaceLanguage, inferWorkspaceMedia, isWorkspaceMarkdownPath, isWorkspaceSkillPath, parseWorkspaceSkill } from "./components/agents-sdk/WorkspaceFile.js";
6
6
  import { c as useWorkspaceNavigationContext, s as useWorkspaceNavigationRestoration } from "./WorkspaceLink-DtH66bAY.js";
7
7
  import { n as createWorkspaceRehypePlugins, t as WorkspaceMessageResponse } from "./WorkspaceMessageResponse-CJCmGvTx.js";
@@ -1,5 +1,5 @@
1
1
  import { canRequestFavicon, inferFaviconUrl } from "../../utils/favicon.js";
2
- import { D as LinkIcon, P as MonitorIcon, Q as TerminalIcon, S as FileIcon, T as InfoIcon, W as SearchIcon, et as WarningIcon, tt as WrenchIcon, z as PencilIcon } from "../../icons-Dw-im7lg.js";
2
+ import { D as LinkIcon, P as MonitorIcon, Q as TerminalIcon, S as FileIcon, T as InfoIcon, W as SearchIcon, et as WarningIcon, tt as WrenchIcon, z as PencilIcon } from "../../icons-BNEY4gO5.js";
3
3
  import * as React from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  //#region src/components/agents-sdk/AgentActivity.tsx
@@ -1,2 +1,2 @@
1
- import { a as PermissionModeControl, i as AgentChatRenderMessageContext, n as AgentChatComposerDraft, o as compactingNotice, r as AgentChatProps, t as AgentChat } from "../../AgentChat-Bibfj7u1.js";
1
+ import { a as PermissionModeControl, i as AgentChatRenderMessageContext, n as AgentChatComposerDraft, o as compactingNotice, r as AgentChatProps, t as AgentChat } from "../../AgentChat-BLmQghkt.js";
2
2
  export { AgentChat, AgentChatComposerDraft, AgentChatProps, AgentChatRenderMessageContext, PermissionModeControl, compactingNotice };
@@ -1,26 +1,28 @@
1
+ import { replaceComposerTrigger } from "../../utils/composer-link.js";
1
2
  import { t as cx } from "../../class-names-BiMDVpUo.js";
2
- import { $ as TrashIcon, H as QueueIcon, I as MoveToFrontIcon, U as RefreshIcon, V as PlusIcon, q as SpinnerIcon, t as ArchiveIcon, z as PencilIcon } from "../../icons-Dw-im7lg.js";
3
+ import { ExpansionStateProvider } from "../ai-sdk/ExpansionState.js";
4
+ import { $ as TrashIcon, H as QueueIcon, I as MoveToFrontIcon, U as RefreshIcon, V as PlusIcon, q as SpinnerIcon, t as ArchiveIcon, z as PencilIcon } from "../../icons-BNEY4gO5.js";
3
5
  import { Button } from "../foundations/Button.js";
6
+ import { AgentChatMessageEditor } from "../ai-sdk/AgentChatMessageEditor.js";
4
7
  import { IconButton } from "../foundations/IconButton.js";
8
+ import { Menu } from "../foundations/Menu.js";
9
+ import { PromptInput, PromptInputActionAddAttachments, PromptInputActionMenu, PromptInputActionMenuContent, PromptInputActionMenuTrigger, PromptInputAttachments, PromptInputBody, PromptInputButton, PromptInputCommandComposer, PromptInputContextSelector, PromptInputDictation, PromptInputFooter, PromptInputHeader, PromptInputPermissionSelector, PromptInputSubmit, PromptInputTextarea, PromptInputTools, PromptInputTray, composerLinksToReferences, usePromptInputAttachments } from "../ai-sdk/PromptInput.js";
10
+ import { AgentChatStartScreen } from "../ai-sdk/AgentChatStartScreen.js";
5
11
  import { Message, MessageAction, MessageActions, MessageMeta, MessageTimestamp } from "../ai-sdk/Message.js";
6
- import { ExpansionStateProvider } from "../ai-sdk/ExpansionState.js";
7
12
  import { AgentMessageParts } from "../ai-sdk/AgentMessageParts.js";
13
+ import { Marker, MarkerContent } from "../foundations/Marker.js";
14
+ import { t as CopyButton } from "../../copy-button-D7ySsRRo.js";
8
15
  import { Context, ContextContent, ContextContentBody, ContextContentHeader, ContextTrigger, getContextUsage, getContextUsedTokens } from "../ai-sdk/Context.js";
9
- import { EmptyState } from "../foundations/EmptyState.js";
10
16
  import { VirtualMessageScroller } from "../ai-sdk/MessageScrollerVirtual.js";
11
17
  import { QueueItem, QueueItemActions, QueueItemContent } from "../ai-sdk/Queue.js";
12
- import { Menu } from "../foundations/Menu.js";
13
- import { PromptInput, PromptInputActionAddAttachments, PromptInputActionMenu, PromptInputActionMenuContent, PromptInputActionMenuTrigger, PromptInputAttachments, PromptInputBody, PromptInputButton, PromptInputCommandComposer, PromptInputContextSelector, PromptInputDictation, PromptInputFooter, PromptInputHeader, PromptInputPermissionSelector, PromptInputReferences, PromptInputSubmit, PromptInputTextarea, PromptInputTools, PromptInputTray, usePromptInputAttachments } from "../ai-sdk/PromptInput.js";
14
- import { AgentChatStartScreen } from "../ai-sdk/AgentChatStartScreen.js";
15
- import { AgentChatMessageEditor } from "../ai-sdk/AgentChatMessageEditor.js";
16
- import { Marker, MarkerContent } from "../foundations/Marker.js";
18
+ import { EmptyState } from "../foundations/EmptyState.js";
17
19
  import { TransitionSurface } from "../foundations/TransitionSurface.js";
20
+ import { AgentEventRow, getAgentEvent } from "./AgentEvent.js";
18
21
  import { PromptInputApproval, getApprovalRequestId, getApprovalStateKey, getPendingToolApprovals } from "./PromptInputApproval.js";
19
- import { t as CopyButton } from "../../copy-button-DHhf-J1d.js";
20
22
  import * as React from "react";
21
23
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
22
- import { isCompactionMessage } from "agents/experimental/memory/utils";
23
24
  import { isTextUIPart } from "ai";
25
+ import { isCompactionMessage } from "agents/experimental/memory/utils";
24
26
  //#region src/components/agents-sdk/AgentChat.tsx
25
27
  /**
26
28
  * Agents exports this helper from `agents/sessions` after cloudflare/agents#1896;
@@ -175,9 +177,13 @@ function isCompactedPart(message, partIndex) {
175
177
  function AgentChatTranscriptRowBodyImpl({ message, messageIndex, status, renderPart, renderMessageAfter, editing, canEdit, editDisabled, onEditAndResend, onStartEdit, onCancelEdit, onFinishEdit, editButtonRef, responseNumber, showAssistantActions, showCopy, showRetry, onRegenerate, onCopyStatus }) {
176
178
  const messageTime = getAgentChatMessageTime(message);
177
179
  const userText = getEditableUserText(message);
180
+ const agentEvent = getAgentEvent(message);
178
181
  return /* @__PURE__ */ jsx(Fragment, { children: isCompactionMessage(message) ? /* @__PURE__ */ jsx(Marker, {
179
182
  variant: "separator",
180
183
  children: /* @__PURE__ */ jsx(MarkerContent, { children: "Context compacted" })
184
+ }) : agentEvent ? /* @__PURE__ */ jsx(AgentEventRow, {
185
+ message,
186
+ event: agentEvent
181
187
  }) : /* @__PURE__ */ jsx(Message, {
182
188
  from: message.role,
183
189
  children: editing && onEditAndResend ? /* @__PURE__ */ jsx(AgentChatMessageEditor, {
@@ -275,7 +281,6 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
275
281
  const disabled = composerDisabled || loading;
276
282
  const [copyAnnouncement, setCopyAnnouncement] = React.useState("");
277
283
  const [composerDraft, setComposerDraft] = React.useState("");
278
- const [composerReferences, setComposerReferences] = React.useState([]);
279
284
  const composerInputRef = React.useRef(null);
280
285
  const restoreComposerFocusAfterApproval = React.useRef(false);
281
286
  const respondToPendingApproval = React.useCallback((response) => {
@@ -293,10 +298,20 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
293
298
  const [compactionState, setCompactionState] = React.useState(null);
294
299
  const compactionInFlight = React.useRef(false);
295
300
  const addComposerReference = React.useCallback((reference) => {
296
- setComposerReferences((current) => current.some((item) => item.id === reference.id && item.trigger === reference.trigger) ? current : [...current, reference]);
301
+ setComposerDraft((current) => {
302
+ if (composerLinksToReferences(current).some((item) => item.id === reference.id && item.trigger === reference.trigger)) return current;
303
+ return replaceComposerTrigger(current, {
304
+ id: reference.id,
305
+ value: reference.value,
306
+ label: reference.label,
307
+ href: reference.href,
308
+ iconSrc: reference.iconSrc
309
+ }, reference.trigger ?? "/");
310
+ });
297
311
  }, []);
298
312
  const removeComposerReference = React.useCallback((reference) => {
299
- setComposerReferences((current) => current.filter((item) => item.id !== reference.id || item.trigger !== reference.trigger));
313
+ if (!reference.href) return;
314
+ setComposerDraft((current) => current.replace(`[${reference.label}](${reference.href})`, "").replace(/\s{2,}/g, " "));
300
315
  }, []);
301
316
  const copyAnnouncementTimer = React.useRef(null);
302
317
  const announceCopyStatus = React.useCallback((message) => {
@@ -311,13 +326,15 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
311
326
  if (copyAnnouncementTimer.current !== null) window.clearTimeout(copyAnnouncementTimer.current);
312
327
  }, []);
313
328
  const handleSubmit = React.useCallback((message) => {
329
+ const text = message.text || composerDraft;
330
+ const references = composerLinksToReferences(text);
314
331
  const prompt = {
315
332
  ...message,
316
- ...composerReferences.length ? { references: composerReferences } : {}
333
+ text,
334
+ ...references.length ? { references } : {}
317
335
  };
318
336
  setQueueHeld(false);
319
337
  setComposerDraft("");
320
- setComposerReferences([]);
321
338
  setCompactionState(null);
322
339
  if (busy || pendingPrompts.length && !queueHeld) {
323
340
  setPendingPrompts((current) => [...current, {
@@ -330,7 +347,7 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
330
347
  return onSubmit?.(prompt);
331
348
  }, [
332
349
  busy,
333
- composerReferences,
350
+ composerDraft,
334
351
  onPromptQueued,
335
352
  onSubmit,
336
353
  pendingPrompts.length,
@@ -369,30 +386,20 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
369
386
  });
370
387
  return;
371
388
  }
372
- const reference = {
373
- id: command.id,
374
- value: command.value,
375
- label: command.label,
376
- icon: command.icon,
377
- trigger
378
- };
379
- const nextReferences = composerReferences.some((item) => item.id === reference.id && item.trigger === reference.trigger) ? composerReferences : [...composerReferences, reference];
380
- addComposerReference(reference);
381
- const catalog = trigger === "@" ? mentionCommands : slashCommands;
382
- if (catalog?.onSelect) catalog.onSelect(command, {
383
- value: composerDraft,
389
+ const nextDraft = replaceComposerTrigger(composerDraft, command, trigger);
390
+ const nextReferences = composerLinksToReferences(nextDraft);
391
+ (trigger === "@" ? mentionCommands : slashCommands)?.onSelect?.(command, {
392
+ value: nextDraft,
384
393
  references: nextReferences,
385
394
  setValue: setComposerDraft,
386
395
  clear: () => setComposerDraft(""),
387
396
  addReference: addComposerReference,
388
397
  removeReference: removeComposerReference
389
398
  });
390
- else setComposerDraft("");
391
399
  }, [
392
400
  addComposerReference,
393
401
  busy,
394
402
  composerDraft,
395
- composerReferences,
396
403
  mentionCommands,
397
404
  onCompact,
398
405
  removeComposerReference,
@@ -482,9 +489,9 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
482
489
  composerInputRef.current?.focus();
483
490
  }, [pendingApprovalKey]);
484
491
  const contextUsage = contextWindow ? getContextUsage(messages) : void 0;
485
- const newestAssistantIndex = messages.findLastIndex((message) => message.role === "assistant" && !isCompactionMessage(message));
492
+ const newestAssistantIndex = messages.findLastIndex((message) => message.role === "assistant" && !isCompactionMessage(message) && !getAgentEvent(message));
486
493
  const lastAssistantIndex = onRegenerate && status !== "streaming" && status !== "submitted" ? newestAssistantIndex : -1;
487
- const lastUserIndex = onEditAndResend ? messages.findLastIndex((message) => message.role === "user") : -1;
494
+ const lastUserIndex = onEditAndResend ? messages.findLastIndex((message) => message.role === "user" && !getAgentEvent(message)) : -1;
488
495
  const [editingMessageId, setEditingMessageId] = React.useState();
489
496
  const restoreEditFocus = React.useRef(false);
490
497
  const editButtonRef = React.useRef(null);
@@ -502,7 +509,7 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
502
509
  }, []);
503
510
  let assistantResponseCount = 0;
504
511
  const assistantResponseNumbers = messages.map((message) => {
505
- if (message.role !== "assistant" || isCompactionMessage(message)) return 0;
512
+ if (message.role !== "assistant" || isCompactionMessage(message) || getAgentEvent(message)) return 0;
506
513
  assistantResponseCount += 1;
507
514
  return assistantResponseCount;
508
515
  });
@@ -614,13 +621,10 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
614
621
  }) : /* @__PURE__ */ jsxs(Fragment, { children: [
615
622
  composerHeader ? /* @__PURE__ */ jsx(PromptInputHeader, { children: composerHeader }) : null,
616
623
  /* @__PURE__ */ jsx(PromptInputAttachments, {}),
617
- /* @__PURE__ */ jsxs(PromptInputBody, { children: [/* @__PURE__ */ jsx(PromptInputReferences, {
618
- references: composerReferences,
619
- onRemove: removeComposerReference
620
- }), slashCommands || mentionCommands || onCompact ? /* @__PURE__ */ jsx(PromptInputCommandComposer, {
624
+ /* @__PURE__ */ jsx(PromptInputBody, { children: slashCommands || mentionCommands || onCompact ? /* @__PURE__ */ jsx(PromptInputCommandComposer, {
621
625
  ref: composerInputRef,
622
626
  "aria-label": "Message",
623
- placeholder: composerReferences.length ? "" : placeholder,
627
+ placeholder,
624
628
  disabled,
625
629
  commands: onCompact && !busy ? [COMPACT_SLASH_COMMAND, ...slashCommands?.items ?? []] : slashCommands?.items ?? [],
626
630
  mentionCommands: mentionCommands?.items,
@@ -634,7 +638,7 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
634
638
  disabled,
635
639
  value: composerDraft,
636
640
  onChange: (event) => setComposerDraft(event.currentTarget.value)
637
- })] }),
641
+ }) }),
638
642
  /* @__PURE__ */ jsxs(PromptInputFooter, { children: [/* @__PURE__ */ jsxs(PromptInputTools, { children: [
639
643
  /* @__PURE__ */ jsx(AgentChatAddMenu, { children: composerAddMenuItems }),
640
644
  contextSelector ? /* @__PURE__ */ jsx(PromptInputContextSelector, { ...contextSelector }) : null,
@@ -663,7 +667,7 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
663
667
  status,
664
668
  onStop: handleStop,
665
669
  disabled,
666
- hasDraft: Boolean(composerDraft.trim() || composerReferences.length)
670
+ hasDraft: Boolean(composerDraft.trim())
667
671
  })
668
672
  ]
669
673
  })] })
@@ -0,0 +1,42 @@
1
+ import * as React from "react";
2
+ import { UIMessage } from "ai";
3
+
4
+ //#region src/components/agents-sdk/AgentEvent.d.ts
5
+ interface AgentEvent {
6
+ source: string;
7
+ runId?: string;
8
+ /** Terminal status of the run this completion notice reports. */
9
+ status?: string;
10
+ /** Milestone name when the turn is a mid-run report, absent for a completion. */
11
+ milestone?: string;
12
+ }
13
+ /**
14
+ * Classify a framework-injected background-run message. Think persists a
15
+ * `submitMessages` turn's metadata under `metadata.turnMetadata` on the
16
+ * user-role message it appends (a completion notice, a `react` milestone), and
17
+ * puts a `narrate` milestone's metadata directly on the assistant message it
18
+ * adds — so both shapes are read. Anything else is an ordinary message.
19
+ */
20
+ declare function getAgentEvent(message: UIMessage): AgentEvent | null;
21
+ interface AgentEventRowProps extends React.HTMLAttributes<HTMLDivElement> {
22
+ message: UIMessage;
23
+ event: AgentEvent;
24
+ }
25
+ /**
26
+ * One collapsed transcript row for a background run's report or completion
27
+ * notice: who reported, what happened, and the first line of what it said;
28
+ * expanding shows the whole text the model received. The run's name comes
29
+ * from the parent's retained-run projection when the row is inside an
30
+ * `AgentToolRunsProvider`.
31
+ */
32
+ declare function AgentEventRow({
33
+ className,
34
+ event,
35
+ message,
36
+ ref,
37
+ ...props
38
+ }: AgentEventRowProps & {
39
+ ref?: React.Ref<HTMLDivElement>;
40
+ }): React.JSX.Element;
41
+ //#endregion
42
+ export { AgentEvent, AgentEventRow, AgentEventRowProps, getAgentEvent };