@yourgpt/copilot-sdk 2.1.8 → 2.5.1-beta.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.
@@ -1709,6 +1709,11 @@ type ChatProps = {
1709
1709
  suggestions?: string;
1710
1710
  footer?: string;
1711
1711
  };
1712
+ /**
1713
+ * Show a copy-to-clipboard button below assistant messages on hover.
1714
+ * @default false
1715
+ */
1716
+ allowToCopyMessage?: boolean;
1712
1717
  /**
1713
1718
  * Configuration for displaying citations from web search results.
1714
1719
  * Set to `false` to disable, or pass config object to customize.
@@ -1924,7 +1929,7 @@ declare function BackButton({ className, children, disabled, "aria-label": ariaL
1924
1929
  */
1925
1930
  type ThreadPickerCompoundProps = Omit<ThreadPickerProps, "value" | "threads" | "onSelect" | "onNewThread" | "onDeleteThread" | "disabled">;
1926
1931
  declare function ThreadPickerCompound(props: ThreadPickerCompoundProps): react_jsx_runtime.JSX.Element | null;
1927
- declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, error, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, upload: uploadProp, processAttachment: deprecatedProcessAttachment, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, mcpToolRenderer, fallbackToolRenderer, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, citations, messageView, renderMessage, wrapMessage, renderInput, renderHeader, groupConsecutiveMessages, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, getBranchInfo, onSwitchBranch, onEditMessage, }: ChatProps): react_jsx_runtime.JSX.Element;
1932
+ declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, error, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, upload: uploadProp, processAttachment: deprecatedProcessAttachment, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, mcpToolRenderer, fallbackToolRenderer, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, citations, allowToCopyMessage, messageView, renderMessage, wrapMessage, renderInput, renderHeader, groupConsecutiveMessages, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, getBranchInfo, onSwitchBranch, onEditMessage, }: ChatProps): react_jsx_runtime.JSX.Element;
1928
1933
  /**
1929
1934
  * Chat component with compound component pattern.
1930
1935
  *
@@ -1709,6 +1709,11 @@ type ChatProps = {
1709
1709
  suggestions?: string;
1710
1710
  footer?: string;
1711
1711
  };
1712
+ /**
1713
+ * Show a copy-to-clipboard button below assistant messages on hover.
1714
+ * @default false
1715
+ */
1716
+ allowToCopyMessage?: boolean;
1712
1717
  /**
1713
1718
  * Configuration for displaying citations from web search results.
1714
1719
  * Set to `false` to disable, or pass config object to customize.
@@ -1924,7 +1929,7 @@ declare function BackButton({ className, children, disabled, "aria-label": ariaL
1924
1929
  */
1925
1930
  type ThreadPickerCompoundProps = Omit<ThreadPickerProps, "value" | "threads" | "onSelect" | "onNewThread" | "onDeleteThread" | "disabled">;
1926
1931
  declare function ThreadPickerCompound(props: ThreadPickerCompoundProps): react_jsx_runtime.JSX.Element | null;
1927
- declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, error, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, upload: uploadProp, processAttachment: deprecatedProcessAttachment, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, mcpToolRenderer, fallbackToolRenderer, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, citations, messageView, renderMessage, wrapMessage, renderInput, renderHeader, groupConsecutiveMessages, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, getBranchInfo, onSwitchBranch, onEditMessage, }: ChatProps): react_jsx_runtime.JSX.Element;
1932
+ declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, error, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, upload: uploadProp, processAttachment: deprecatedProcessAttachment, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, mcpToolRenderer, fallbackToolRenderer, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, citations, allowToCopyMessage, messageView, renderMessage, wrapMessage, renderInput, renderHeader, groupConsecutiveMessages, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, getBranchInfo, onSwitchBranch, onEditMessage, }: ChatProps): react_jsx_runtime.JSX.Element;
1928
1933
  /**
1929
1934
  * Chat component with compound component pattern.
1930
1935
  *
package/dist/ui/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { useThreadManager } from '../chunk-H3LX6FTP.js';
1
+ import { useThreadManager } from '../chunk-YYLTWY5R.js';
2
2
  import { DEFAULT_MCP_UI_SANDBOX, parseMCPUIMessage } from '../chunk-G4SF2PNQ.js';
3
3
  import { cn, Loader, TextShimmerLoader } from '../chunk-TXQ37MAO.js';
4
4
  export { Loader, cn } from '../chunk-TXQ37MAO.js';
5
- import { useCopilot } from '../chunk-ISOMZAYN.js';
5
+ import { useCopilot } from '../chunk-JPUKXFR4.js';
6
6
  import { createLocalStorageAdapter, createServerAdapter } from '../chunk-J5D3AZF6.js';
7
7
  import '../chunk-EWVQWTNV.js';
8
8
  import '../chunk-VNLLW3ZI.js';
@@ -4309,7 +4309,8 @@ function FloatingActions({
4309
4309
  message,
4310
4310
  role,
4311
4311
  align = "left",
4312
- onEdit
4312
+ onEdit,
4313
+ className
4313
4314
  }) {
4314
4315
  const ctx = useMessageActionsContext();
4315
4316
  const [copiedId, setCopiedId] = React19.useState(null);
@@ -4320,9 +4321,10 @@ function FloatingActions({
4320
4321
  "div",
4321
4322
  {
4322
4323
  className: cn(
4323
- "flex items-center gap-0.5 mt-1",
4324
+ "csdk-message-actions flex items-center gap-0.5",
4324
4325
  "opacity-0 group-hover/message:opacity-100 transition-opacity duration-150",
4325
- align === "right" ? "justify-end" : "justify-start"
4326
+ align === "right" ? "justify-end" : "justify-start",
4327
+ className
4326
4328
  ),
4327
4329
  children: actions.map((action) => {
4328
4330
  const isHidden = typeof action.hidden === "function" ? action.hidden({ message }) : action.hidden;
@@ -4335,7 +4337,9 @@ function FloatingActions({
4335
4337
  title: action.tooltip,
4336
4338
  "aria-label": action.tooltip,
4337
4339
  className: cn(
4338
- "flex items-center justify-center size-6 rounded-md",
4340
+ "csdk-message-action-btn",
4341
+ action.id === "copy" && "csdk-copy-btn",
4342
+ "flex items-center justify-center size-6 rounded-md cursor-pointer",
4339
4343
  "text-muted-foreground hover:text-foreground hover:bg-muted",
4340
4344
  "transition-colors",
4341
4345
  action.className
@@ -4725,7 +4729,7 @@ function DefaultMessage({
4725
4729
  ),
4726
4730
  isLastMessage && isProcessing && !completedTools?.length && !pendingApprovalTools?.length ? /* @__PURE__ */ jsx("div", { className: "rounded-lg bg-muted px-4 py-2", children: /* @__PURE__ */ jsx(Loader, { variant: "dots", size: "sm" }) }) : (
4727
4731
  /* Show streaming loader when loading with no content and no tools */
4728
- isLastMessage && isLoading && !cleanContent?.trim() && !toolsWithCustomRender?.length && !toolsWithoutCustomRender?.length && !pendingApprovalTools?.length ? /* @__PURE__ */ jsx("div", { className: "rounded-lg bg-muted px-4 py-2", children: /* @__PURE__ */ jsx(Loader, { variant: loaderVariant, size: "sm" }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
4732
+ isLastMessage && isLoading && !cleanContent?.trim() && !toolsWithCustomRender?.length && !toolsWithoutCustomRender?.length && !pendingApprovalTools?.length ? /* @__PURE__ */ jsx("div", { className: "rounded-lg bg-muted px-4 py-2", children: /* @__PURE__ */ jsx(Loader, { variant: loaderVariant, size: "sm" }) }) : /* @__PURE__ */ jsxs("div", { className: "relative", children: [
4729
4733
  cleanContent?.trim() && /* @__PURE__ */ jsx(
4730
4734
  MessageContent,
4731
4735
  {
@@ -4926,7 +4930,15 @@ function DefaultMessage({
4926
4930
  buttonClassName: followUpButtonClassName
4927
4931
  }
4928
4932
  ),
4929
- /* @__PURE__ */ jsx(FloatingActions, { message, role: "assistant", align: "left" })
4933
+ /* @__PURE__ */ jsx(
4934
+ FloatingActions,
4935
+ {
4936
+ message,
4937
+ role: "assistant",
4938
+ align: "right",
4939
+ className: "absolute bottom-1 right-1"
4940
+ }
4941
+ )
4930
4942
  ] })
4931
4943
  )
4932
4944
  ] })
@@ -5925,6 +5937,8 @@ function ChatComponent({
5925
5937
  followUpButtonClassName,
5926
5938
  // Citations/Sources
5927
5939
  citations,
5940
+ // Message Actions
5941
+ allowToCopyMessage = false,
5928
5942
  // Custom rendering
5929
5943
  messageView,
5930
5944
  renderMessage,
@@ -6227,6 +6241,7 @@ function ChatComponent({
6227
6241
  }
6228
6242
  )),
6229
6243
  rootHeader,
6244
+ allowToCopyMessage && /* @__PURE__ */ jsx(MessageActions2, { role: "assistant", children: /* @__PURE__ */ jsx(CopyAction, {}) }),
6230
6245
  behaviorChildren.length > 0 && behaviorChildren,
6231
6246
  hasCustomLayout && viewChildren,
6232
6247
  showDefaultWelcome ? (