@yourgpt/copilot-sdk 1.4.34 → 1.4.36

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/styles.css CHANGED
@@ -1,66 +1,61 @@
1
1
  /* YourGPT Copilot SDK - Base Styles */
2
- /* Default neutral theme */
3
-
4
- :root {
5
- --background: hsl(0 0% 100%);
6
- --foreground: hsl(240 10% 3.9%);
7
-
8
- --card: hsl(0 0% 100%);
9
- --card-foreground: hsl(240 10% 3.9%);
10
-
11
- --popover: hsl(0 0% 100%);
12
- --popover-foreground: hsl(240 10% 3.9%);
13
-
14
- --primary: hsl(240 5.9% 10%);
15
- --primary-foreground: hsl(0 0% 98%);
16
-
17
- --secondary: hsl(240 4.8% 95.9%);
18
- --secondary-foreground: hsl(240 5.9% 10%);
19
-
20
- --muted: hsl(240 4.8% 95.9%);
21
- --muted-foreground: hsl(240 3.8% 46.1%);
22
-
23
- --accent: hsl(240 4.8% 95.9%);
24
- --accent-foreground: hsl(240 5.9% 10%);
25
-
26
- --destructive: hsl(0 84.2% 60.2%);
27
- --destructive-foreground: hsl(0 0% 98%);
28
-
29
- --border: hsl(240 5.9% 90%);
30
- --input: hsl(240 5.9% 90%);
31
- --ring: hsl(240 5.9% 10%);
32
-
33
- --radius: 0.5rem;
34
- }
35
-
36
- .dark {
37
- --background: hsl(240 10% 3.9%);
38
- --foreground: hsl(0 0% 98%);
39
-
40
- --card: hsl(240 10% 3.9%);
41
- --card-foreground: hsl(0 0% 98%);
42
-
43
- --popover: hsl(240 10% 3.9%);
44
- --popover-foreground: hsl(0 0% 98%);
45
-
46
- --primary: hsl(0 0% 98%);
47
- --primary-foreground: hsl(240 5.9% 10%);
48
-
49
- --secondary: hsl(240 3.7% 15.9%);
50
- --secondary-foreground: hsl(0 0% 98%);
51
-
52
- --muted: hsl(240 3.7% 15.9%);
53
- --muted-foreground: hsl(240 5% 64.9%);
54
-
55
- --accent: hsl(240 3.7% 15.9%);
56
- --accent-foreground: hsl(0 0% 98%);
57
-
58
- --destructive: hsl(0 62.8% 30.6%);
59
- --destructive-foreground: hsl(0 0% 98%);
60
-
61
- --border: hsl(240 3.7% 15.9%);
62
- --input: hsl(240 3.7% 15.9%);
63
- --ring: hsl(240 4.9% 83.9%);
2
+ /*
3
+ * IMPORTANT: These are fallback defaults only.
4
+ * If user has their own shadcn/ui CSS variables defined on :root,
5
+ * those will be used instead (user styles should be imported AFTER this file
6
+ * or defined outside @layer to take precedence).
7
+ *
8
+ * To ensure your app's variables take precedence:
9
+ * 1. Import SDK styles first: import "@yourgpt/copilot-sdk/ui/styles.css"
10
+ * 2. Then import your globals.css with your :root variables
11
+ */
12
+
13
+ /* Low-priority layer for SDK defaults - user styles will override */
14
+ @layer csdk-base {
15
+ :root {
16
+ --background: hsl(0 0% 100%);
17
+ --foreground: hsl(240 10% 3.9%);
18
+ --card: hsl(0 0% 100%);
19
+ --card-foreground: hsl(240 10% 3.9%);
20
+ --popover: hsl(0 0% 100%);
21
+ --popover-foreground: hsl(240 10% 3.9%);
22
+ --primary: hsl(240 5.9% 10%);
23
+ --primary-foreground: hsl(0 0% 98%);
24
+ --secondary: hsl(240 4.8% 95.9%);
25
+ --secondary-foreground: hsl(240 5.9% 10%);
26
+ --muted: hsl(240 4.8% 95.9%);
27
+ --muted-foreground: hsl(240 3.8% 46.1%);
28
+ --accent: hsl(240 4.8% 95.9%);
29
+ --accent-foreground: hsl(240 5.9% 10%);
30
+ --destructive: hsl(0 84.2% 60.2%);
31
+ --destructive-foreground: hsl(0 0% 98%);
32
+ --border: hsl(240 5.9% 90%);
33
+ --input: hsl(240 5.9% 90%);
34
+ --ring: hsl(240 5.9% 10%);
35
+ --radius: 0.5rem;
36
+ }
37
+
38
+ .dark {
39
+ --background: hsl(240 10% 3.9%);
40
+ --foreground: hsl(0 0% 98%);
41
+ --card: hsl(240 10% 3.9%);
42
+ --card-foreground: hsl(0 0% 98%);
43
+ --popover: hsl(240 10% 3.9%);
44
+ --popover-foreground: hsl(0 0% 98%);
45
+ --primary: hsl(0 0% 98%);
46
+ --primary-foreground: hsl(240 5.9% 10%);
47
+ --secondary: hsl(240 3.7% 15.9%);
48
+ --secondary-foreground: hsl(0 0% 98%);
49
+ --muted: hsl(240 3.7% 15.9%);
50
+ --muted-foreground: hsl(240 5% 64.9%);
51
+ --accent: hsl(240 3.7% 15.9%);
52
+ --accent-foreground: hsl(0 0% 98%);
53
+ --destructive: hsl(0 62.8% 30.6%);
54
+ --destructive-foreground: hsl(0 0% 98%);
55
+ --border: hsl(240 3.7% 15.9%);
56
+ --input: hsl(240 3.7% 15.9%);
57
+ --ring: hsl(240 4.9% 83.9%);
58
+ }
64
59
  }
65
60
 
66
61
  /* Loader Animations */
package/dist/ui/index.cjs CHANGED
@@ -59,7 +59,7 @@ function DotsLoader({
59
59
  "div",
60
60
  {
61
61
  className: cn(
62
- "flex items-end space-x-1",
62
+ "flex items-center translate-y-[-2px] space-x-1",
63
63
  containerSizes[size],
64
64
  className
65
65
  ),
@@ -199,15 +199,7 @@ function TerminalLoader({
199
199
  ),
200
200
  children: [
201
201
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-primary font-mono", textSizes[size]), children: ">" }),
202
- /* @__PURE__ */ jsxRuntime.jsx(
203
- "div",
204
- {
205
- className: cn(
206
- "bg-primary csdk-loader-blink",
207
- cursorSizes[size]
208
- )
209
- }
210
- ),
202
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("bg-primary csdk-loader-blink", cursorSizes[size]) }),
211
203
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading" })
212
204
  ]
213
205
  }
@@ -605,7 +597,7 @@ function ScrollButton({
605
597
  variant,
606
598
  size,
607
599
  className: cn(
608
- "h-10 w-10 rounded-full transition-all duration-150 ease-out shadow-md",
600
+ "h-10 w-10 rounded-full transition-all duration-150 ease-out shadow-md bg-background",
609
601
  !isAtBottom ? "translate-y-0 scale-100 opacity-100" : "pointer-events-none translate-y-4 scale-95 opacity-0",
610
602
  className
611
603
  ),
@@ -683,7 +675,7 @@ var AvatarImage = React18__namespace.forwardRef(({ className, ...props }, ref) =
683
675
  AvatarPrimitive__namespace.Image,
684
676
  {
685
677
  ref,
686
- className: cn("aspect-square h-full w-full", className),
678
+ className: cn("aspect-square h-full w-full object-cover", className),
687
679
  ...props
688
680
  }
689
681
  ));
@@ -703,12 +695,16 @@ AvatarFallback.displayName = AvatarPrimitive__namespace.Fallback.displayName;
703
695
  var Message = ({ children, className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("csdk-message flex gap-3", className), ...props, children });
704
696
  var MessageAvatar = ({
705
697
  src,
706
- alt,
698
+ alt = "Avatar",
707
699
  fallback,
708
700
  fallbackIcon,
701
+ children,
709
702
  delayMs,
710
703
  className
711
704
  }) => {
705
+ if (children) {
706
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("csdk-avatar flex shrink-0 size-7", className), children });
707
+ }
712
708
  return /* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: cn("csdk-avatar size-7 shrink-0", className), children: [
713
709
  /* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src, alt }),
714
710
  /* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { delayMs, children: fallbackIcon || fallback })
@@ -3505,9 +3501,10 @@ function DefaultMessage({
3505
3501
  showUserAvatar && /* @__PURE__ */ jsxRuntime.jsx(
3506
3502
  MessageAvatar,
3507
3503
  {
3508
- src: userAvatar.src || "",
3504
+ src: userAvatar.src,
3509
3505
  alt: "User",
3510
- fallback: userAvatar.fallback
3506
+ fallback: userAvatar.fallback,
3507
+ children: userAvatar.component
3511
3508
  }
3512
3509
  )
3513
3510
  ]
@@ -3544,11 +3541,12 @@ function DefaultMessage({
3544
3541
  /* @__PURE__ */ jsxRuntime.jsx(
3545
3542
  MessageAvatar,
3546
3543
  {
3547
- src: assistantAvatar.src || "",
3544
+ src: assistantAvatar.src,
3548
3545
  alt: "Assistant",
3549
3546
  fallback: assistantAvatar.fallback,
3550
- fallbackIcon: !assistantAvatar.src && !assistantAvatar.fallback ? /* @__PURE__ */ jsxRuntime.jsx(copilot_sdk_logo_default, { className: "size-5" }) : void 0,
3551
- className: "bg-muted"
3547
+ fallbackIcon: !assistantAvatar.src && !assistantAvatar.fallback && !assistantAvatar.component ? /* @__PURE__ */ jsxRuntime.jsx(copilot_sdk_logo_default, { className: "size-5" }) : void 0,
3548
+ className: "bg-muted",
3549
+ children: assistantAvatar.component
3552
3550
  }
3553
3551
  ),
3554
3552
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 max-w-[80%] w-fit", children: [
@@ -3614,7 +3612,9 @@ function DefaultMessage({
3614
3612
  toolCallId: exec.id,
3615
3613
  toolName: exec.name
3616
3614
  };
3617
- const output = toolDef.render(renderProps);
3615
+ const output = toolDef.render(
3616
+ renderProps
3617
+ );
3618
3618
  return /* @__PURE__ */ jsxRuntime.jsx(React18__namespace.Fragment, { children: output }, exec.id);
3619
3619
  }
3620
3620
  return null;
@@ -3650,7 +3650,9 @@ function DefaultMessage({
3650
3650
  toolName: tool.name,
3651
3651
  approval: approvalCallbacks
3652
3652
  };
3653
- const output = toolDef.render(renderProps);
3653
+ const output = toolDef.render(
3654
+ renderProps
3655
+ );
3654
3656
  return /* @__PURE__ */ jsxRuntime.jsx(React18__namespace.Fragment, { children: output }, tool.id);
3655
3657
  }
3656
3658
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -3664,7 +3666,11 @@ function DefaultMessage({
3664
3666
  void 0,
3665
3667
  permissionLevel
3666
3668
  ),
3667
- onReject: (permissionLevel) => onRejectToolExecution?.(tool.id, void 0, permissionLevel)
3669
+ onReject: (permissionLevel) => onRejectToolExecution?.(
3670
+ tool.id,
3671
+ void 0,
3672
+ permissionLevel
3673
+ )
3668
3674
  },
3669
3675
  tool.id
3670
3676
  );
@@ -4346,8 +4352,8 @@ function ChatComponent({
4346
4352
  // Appearance
4347
4353
  showPoweredBy = true,
4348
4354
  showUserAvatar = false,
4349
- userAvatar = { fallback: "U" },
4350
- assistantAvatar = { fallback: "AI" },
4355
+ userAvatar: userAvatarProp,
4356
+ assistantAvatar: assistantAvatarProp,
4351
4357
  loaderVariant = "typing",
4352
4358
  fontSize = "sm",
4353
4359
  // Attachments
@@ -4389,6 +4395,8 @@ function ChatComponent({
4389
4395
  onSwitchThread,
4390
4396
  isThreadBusy
4391
4397
  }) {
4398
+ const userAvatar = { fallback: "U", ...userAvatarProp };
4399
+ const assistantAvatar = { fallback: "AI", ...assistantAvatarProp };
4392
4400
  const [input, setInput] = React18.useState("");
4393
4401
  const [pendingAttachments, setPendingAttachments] = React18.useState([]);
4394
4402
  const [isDragging, setIsDragging] = React18.useState(false);