@yourgpt/copilot-sdk 2.5.1-beta.0 → 2.5.1-beta.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.
package/dist/ui/index.cjs CHANGED
@@ -4333,7 +4333,8 @@ function FloatingActions({
4333
4333
  role,
4334
4334
  align = "left",
4335
4335
  onEdit,
4336
- className
4336
+ className,
4337
+ copyContent
4337
4338
  }) {
4338
4339
  const ctx = useMessageActionsContext();
4339
4340
  const [copiedId, setCopiedId] = React19__namespace.useState(null);
@@ -4351,6 +4352,9 @@ function FloatingActions({
4351
4352
  ),
4352
4353
  children: actions.map((action) => {
4353
4354
  const isHidden = typeof action.hidden === "function" ? action.hidden({ message }) : action.hidden;
4355
+ if (action.id === "copy" && copyContent != null && !copyContent.trim())
4356
+ return null;
4357
+ if (action.id === "copy" && copyContent === null) return null;
4354
4358
  if (isHidden) return null;
4355
4359
  const isCopied = copiedId === action.id;
4356
4360
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -4373,7 +4377,8 @@ function FloatingActions({
4373
4377
  return;
4374
4378
  }
4375
4379
  if (action.id === "copy") {
4376
- navigator.clipboard.writeText(message.content ?? "");
4380
+ const text = copyContent !== void 0 ? copyContent ?? "" : message.content ?? "";
4381
+ navigator.clipboard.writeText(text);
4377
4382
  setCopiedId("copy");
4378
4383
  setTimeout(() => setCopiedId(null), 1500);
4379
4384
  return;
@@ -4753,18 +4758,30 @@ function DefaultMessage({
4753
4758
  isLastMessage && isProcessing && !completedTools?.length && !pendingApprovalTools?.length ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg bg-muted px-4 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(chunk5EGBIQYS_cjs.Loader, { variant: "dots", size: "sm" }) }) : (
4754
4759
  /* Show streaming loader when loading with no content and no tools */
4755
4760
  isLastMessage && isLoading && !cleanContent?.trim() && !toolsWithCustomRender?.length && !toolsWithoutCustomRender?.length && !pendingApprovalTools?.length ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg bg-muted px-4 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(chunk5EGBIQYS_cjs.Loader, { variant: loaderVariant, size: "sm" }) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
4756
- cleanContent?.trim() && /* @__PURE__ */ jsxRuntime.jsx(
4757
- MessageContent,
4758
- {
4759
- className: chunk5EGBIQYS_cjs.cn(
4760
- "csdk-message-assistant rounded-lg px-4 py-2 bg-muted",
4761
- assistantMessageClassName
4762
- ),
4763
- markdown: true,
4764
- size,
4765
- children: cleanContent
4766
- }
4767
- ),
4761
+ cleanContent?.trim() && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
4762
+ /* @__PURE__ */ jsxRuntime.jsx(
4763
+ MessageContent,
4764
+ {
4765
+ className: chunk5EGBIQYS_cjs.cn(
4766
+ "csdk-message-assistant rounded-lg px-4 py-2 bg-muted",
4767
+ assistantMessageClassName
4768
+ ),
4769
+ markdown: true,
4770
+ size,
4771
+ children: cleanContent
4772
+ }
4773
+ ),
4774
+ /* @__PURE__ */ jsxRuntime.jsx(
4775
+ FloatingActions,
4776
+ {
4777
+ message,
4778
+ role: "assistant",
4779
+ align: "right",
4780
+ className: "absolute bottom-1 right-1",
4781
+ copyContent: cleanContent
4782
+ }
4783
+ )
4784
+ ] }),
4768
4785
  toolsWithCustomRender && toolsWithCustomRender.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk5EGBIQYS_cjs.cn("space-y-2", cleanContent?.trim() && "mt-2"), children: toolsWithCustomRender.map((exec) => {
4769
4786
  const toolDef = registeredTools?.find(
4770
4787
  (t) => t.name === exec.name
@@ -4952,15 +4969,6 @@ function DefaultMessage({
4952
4969
  className: followUpClassName,
4953
4970
  buttonClassName: followUpButtonClassName
4954
4971
  }
4955
- ),
4956
- /* @__PURE__ */ jsxRuntime.jsx(
4957
- FloatingActions,
4958
- {
4959
- message,
4960
- role: "assistant",
4961
- align: "right",
4962
- className: "absolute bottom-1 right-1"
4963
- }
4964
4972
  )
4965
4973
  ] })
4966
4974
  )