@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.js CHANGED
@@ -4310,7 +4310,8 @@ function FloatingActions({
4310
4310
  role,
4311
4311
  align = "left",
4312
4312
  onEdit,
4313
- className
4313
+ className,
4314
+ copyContent
4314
4315
  }) {
4315
4316
  const ctx = useMessageActionsContext();
4316
4317
  const [copiedId, setCopiedId] = React19.useState(null);
@@ -4328,6 +4329,9 @@ function FloatingActions({
4328
4329
  ),
4329
4330
  children: actions.map((action) => {
4330
4331
  const isHidden = typeof action.hidden === "function" ? action.hidden({ message }) : action.hidden;
4332
+ if (action.id === "copy" && copyContent != null && !copyContent.trim())
4333
+ return null;
4334
+ if (action.id === "copy" && copyContent === null) return null;
4331
4335
  if (isHidden) return null;
4332
4336
  const isCopied = copiedId === action.id;
4333
4337
  return /* @__PURE__ */ jsx(
@@ -4350,7 +4354,8 @@ function FloatingActions({
4350
4354
  return;
4351
4355
  }
4352
4356
  if (action.id === "copy") {
4353
- navigator.clipboard.writeText(message.content ?? "");
4357
+ const text = copyContent !== void 0 ? copyContent ?? "" : message.content ?? "";
4358
+ navigator.clipboard.writeText(text);
4354
4359
  setCopiedId("copy");
4355
4360
  setTimeout(() => setCopiedId(null), 1500);
4356
4361
  return;
@@ -4730,18 +4735,30 @@ function DefaultMessage({
4730
4735
  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" }) }) : (
4731
4736
  /* Show streaming loader when loading with no content and no tools */
4732
4737
  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: [
4733
- cleanContent?.trim() && /* @__PURE__ */ jsx(
4734
- MessageContent,
4735
- {
4736
- className: cn(
4737
- "csdk-message-assistant rounded-lg px-4 py-2 bg-muted",
4738
- assistantMessageClassName
4739
- ),
4740
- markdown: true,
4741
- size,
4742
- children: cleanContent
4743
- }
4744
- ),
4738
+ cleanContent?.trim() && /* @__PURE__ */ jsxs("div", { className: "relative", children: [
4739
+ /* @__PURE__ */ jsx(
4740
+ MessageContent,
4741
+ {
4742
+ className: cn(
4743
+ "csdk-message-assistant rounded-lg px-4 py-2 bg-muted",
4744
+ assistantMessageClassName
4745
+ ),
4746
+ markdown: true,
4747
+ size,
4748
+ children: cleanContent
4749
+ }
4750
+ ),
4751
+ /* @__PURE__ */ jsx(
4752
+ FloatingActions,
4753
+ {
4754
+ message,
4755
+ role: "assistant",
4756
+ align: "right",
4757
+ className: "absolute bottom-1 right-1",
4758
+ copyContent: cleanContent
4759
+ }
4760
+ )
4761
+ ] }),
4745
4762
  toolsWithCustomRender && toolsWithCustomRender.length > 0 && /* @__PURE__ */ jsx("div", { className: cn("space-y-2", cleanContent?.trim() && "mt-2"), children: toolsWithCustomRender.map((exec) => {
4746
4763
  const toolDef = registeredTools?.find(
4747
4764
  (t) => t.name === exec.name
@@ -4929,15 +4946,6 @@ function DefaultMessage({
4929
4946
  className: followUpClassName,
4930
4947
  buttonClassName: followUpButtonClassName
4931
4948
  }
4932
- ),
4933
- /* @__PURE__ */ jsx(
4934
- FloatingActions,
4935
- {
4936
- message,
4937
- role: "assistant",
4938
- align: "right",
4939
- className: "absolute bottom-1 right-1"
4940
- }
4941
4949
  )
4942
4950
  ] })
4943
4951
  )