@yourgpt/copilot-sdk 1.2.7 → 1.2.8

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
@@ -5,12 +5,9 @@ var chunkMTFU6EHR_cjs = require('../chunk-MTFU6EHR.cjs');
5
5
  var clsx = require('clsx');
6
6
  var tailwindMerge = require('tailwind-merge');
7
7
  var jsxRuntime = require('react/jsx-runtime');
8
- var marked = require('marked');
9
- var React8 = require('react');
10
- var ReactMarkdown = require('react-markdown');
11
- var remarkBreaks = require('remark-breaks');
12
- var remarkGfm = require('remark-gfm');
13
- var shiki = require('shiki');
8
+ var React7 = require('react');
9
+ var streamdown = require('streamdown');
10
+ var code = require('@streamdown/code');
14
11
  var reactSlot = require('@radix-ui/react-slot');
15
12
  var classVarianceAuthority = require('class-variance-authority');
16
13
  var useStickToBottom = require('use-stick-to-bottom');
@@ -19,8 +16,6 @@ var AvatarPrimitive = require('@radix-ui/react-avatar');
19
16
  var HoverCardPrimitive = require('@radix-ui/react-hover-card');
20
17
  var popover = require('@base-ui/react/popover');
21
18
 
22
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
23
-
24
19
  function _interopNamespace(e) {
25
20
  if (e && e.__esModule) return e;
26
21
  var n = Object.create(null);
@@ -39,10 +34,7 @@ function _interopNamespace(e) {
39
34
  return Object.freeze(n);
40
35
  }
41
36
 
42
- var React8__namespace = /*#__PURE__*/_interopNamespace(React8);
43
- var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
44
- var remarkBreaks__default = /*#__PURE__*/_interopDefault(remarkBreaks);
45
- var remarkGfm__default = /*#__PURE__*/_interopDefault(remarkGfm);
37
+ var React7__namespace = /*#__PURE__*/_interopNamespace(React7);
46
38
  var AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespace(AvatarPrimitive);
47
39
  var HoverCardPrimitive__namespace = /*#__PURE__*/_interopNamespace(HoverCardPrimitive);
48
40
 
@@ -444,6 +436,15 @@ function Loader({
444
436
  return /* @__PURE__ */ jsxRuntime.jsx(CircularLoader, { size, className });
445
437
  }
446
438
  }
439
+ function MarkdownComponent({
440
+ children,
441
+ className,
442
+ isStreaming = false
443
+ }) {
444
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx(streamdown.Streamdown, { plugins: { code: code.code }, isAnimating: isStreaming, children }) });
445
+ }
446
+ var Markdown = React7.memo(MarkdownComponent);
447
+ Markdown.displayName = "Markdown";
447
448
  function CodeBlock({ children, className, ...props }) {
448
449
  return /* @__PURE__ */ jsxRuntime.jsx(
449
450
  "div",
@@ -458,109 +459,6 @@ function CodeBlock({ children, className, ...props }) {
458
459
  }
459
460
  );
460
461
  }
461
- function CodeBlockCode({
462
- code,
463
- language = "tsx",
464
- theme = "github-light",
465
- className,
466
- ...props
467
- }) {
468
- const [highlightedHtml, setHighlightedHtml] = React8.useState(null);
469
- React8.useEffect(() => {
470
- async function highlight() {
471
- if (!code) {
472
- setHighlightedHtml("<pre><code></code></pre>");
473
- return;
474
- }
475
- const html = await shiki.codeToHtml(code, { lang: language, theme });
476
- setHighlightedHtml(html);
477
- }
478
- highlight();
479
- }, [code, language, theme]);
480
- const classNames = cn(
481
- "w-full overflow-x-auto text-[13px] [&>pre]:px-4 [&>pre]:py-4",
482
- className
483
- );
484
- return highlightedHtml ? /* @__PURE__ */ jsxRuntime.jsx(
485
- "div",
486
- {
487
- className: classNames,
488
- dangerouslySetInnerHTML: { __html: highlightedHtml },
489
- ...props
490
- }
491
- ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames, ...props, children: /* @__PURE__ */ jsxRuntime.jsx("pre", { children: /* @__PURE__ */ jsxRuntime.jsx("code", { children: code }) }) });
492
- }
493
- function parseMarkdownIntoBlocks(markdown) {
494
- const tokens = marked.marked.lexer(markdown);
495
- return tokens.map((token) => token.raw);
496
- }
497
- function extractLanguage(className) {
498
- if (!className) return "plaintext";
499
- const match = className.match(/language-(\w+)/);
500
- return match ? match[1] : "plaintext";
501
- }
502
- var INITIAL_COMPONENTS = {
503
- code: function CodeComponent({ className, children, ...props }) {
504
- const isInline = !props.node?.position?.start.line || props.node?.position?.start.line === props.node?.position?.end.line;
505
- if (isInline) {
506
- return /* @__PURE__ */ jsxRuntime.jsx(
507
- "span",
508
- {
509
- className: cn(
510
- "bg-primary-foreground rounded-sm px-1 font-mono text-sm",
511
- className
512
- ),
513
- ...props,
514
- children
515
- }
516
- );
517
- }
518
- const language = extractLanguage(className);
519
- return /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { className, children: /* @__PURE__ */ jsxRuntime.jsx(CodeBlockCode, { code: children, language }) });
520
- },
521
- pre: function PreComponent({ children }) {
522
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
523
- }
524
- };
525
- var MemoizedMarkdownBlock = React8.memo(
526
- function MarkdownBlock({
527
- content,
528
- components = INITIAL_COMPONENTS
529
- }) {
530
- return /* @__PURE__ */ jsxRuntime.jsx(
531
- ReactMarkdown__default.default,
532
- {
533
- remarkPlugins: [remarkGfm__default.default, remarkBreaks__default.default],
534
- components,
535
- children: content
536
- }
537
- );
538
- },
539
- function propsAreEqual(prevProps, nextProps) {
540
- return prevProps.content === nextProps.content;
541
- }
542
- );
543
- MemoizedMarkdownBlock.displayName = "MemoizedMarkdownBlock";
544
- function MarkdownComponent({
545
- children,
546
- id,
547
- className,
548
- components = INITIAL_COMPONENTS
549
- }) {
550
- const generatedId = React8.useId();
551
- const blockId = id ?? generatedId;
552
- const blocks = React8.useMemo(() => parseMarkdownIntoBlocks(children), [children]);
553
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: blocks.map((block, index) => /* @__PURE__ */ jsxRuntime.jsx(
554
- MemoizedMarkdownBlock,
555
- {
556
- content: block,
557
- components
558
- },
559
- `${blockId}-block-${index}`
560
- )) });
561
- }
562
- var Markdown = React8.memo(MarkdownComponent);
563
- Markdown.displayName = "Markdown";
564
462
  var buttonVariants = classVarianceAuthority.cva(
565
463
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
566
464
  {
@@ -586,7 +484,7 @@ var buttonVariants = classVarianceAuthority.cva(
586
484
  }
587
485
  }
588
486
  );
589
- var Button = React8__namespace.forwardRef(
487
+ var Button = React7__namespace.forwardRef(
590
488
  ({ className, variant, size, asChild = false, ...props }, ref) => {
591
489
  const Comp = asChild ? reactSlot.Slot : "button";
592
490
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -827,7 +725,7 @@ function TooltipTrigger({
827
725
  disabled,
828
726
  ...props
829
727
  }) {
830
- if (asChild && React8__namespace.default.isValidElement(children)) {
728
+ if (asChild && React7__namespace.default.isValidElement(children)) {
831
729
  return /* @__PURE__ */ jsxRuntime.jsx(tooltip.Tooltip.Trigger, { disabled, render: children, ...props });
832
730
  }
833
731
  return /* @__PURE__ */ jsxRuntime.jsx(tooltip.Tooltip.Trigger, { disabled, ...props, children });
@@ -856,7 +754,7 @@ function TooltipContent({
856
754
  }
857
755
  ) }) });
858
756
  }
859
- var Avatar = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
757
+ var Avatar = React7__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
860
758
  AvatarPrimitive__namespace.Root,
861
759
  {
862
760
  ref,
@@ -868,7 +766,7 @@ var Avatar = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @
868
766
  }
869
767
  ));
870
768
  Avatar.displayName = AvatarPrimitive__namespace.Root.displayName;
871
- var AvatarImage = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
769
+ var AvatarImage = React7__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
872
770
  AvatarPrimitive__namespace.Image,
873
771
  {
874
772
  ref,
@@ -877,7 +775,7 @@ var AvatarImage = React8__namespace.forwardRef(({ className, ...props }, ref) =>
877
775
  }
878
776
  ));
879
777
  AvatarImage.displayName = AvatarPrimitive__namespace.Image.displayName;
880
- var AvatarFallback = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
778
+ var AvatarFallback = React7__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
881
779
  AvatarPrimitive__namespace.Fallback,
882
780
  {
883
781
  ref,
@@ -918,12 +816,19 @@ var MessageContent = ({
918
816
  const classNames = cn(
919
817
  "rounded-lg p-2 bg-secondary prose break-words whitespace-normal max-w-none",
920
818
  "text-foreground prose-headings:text-foreground prose-p:text-foreground prose-strong:text-foreground prose-li:text-foreground prose-a:text-foreground prose-ol:text-foreground prose-ul:text-foreground prose-code:text-foreground",
819
+ // Compact spacing overrides
820
+ "prose-p:my-1 prose-p:leading-relaxed",
821
+ "prose-ul:my-1 prose-ol:my-1 prose-li:my-0.5",
822
+ "prose-headings:my-2 first:prose-headings:mt-0",
823
+ "prose-pre:my-2 prose-blockquote:my-2",
824
+ // List styling overrides (fix Streamdown's list-inside)
825
+ "[&_ul]:list-outside [&_ol]:list-outside [&_ul]:pl-4 [&_ol]:pl-4 [&_li]:pl-0",
921
826
  proseSizeMap[size],
922
827
  className
923
828
  );
924
829
  return markdown ? /* @__PURE__ */ jsxRuntime.jsx(Markdown, { className: classNames, ...props, children }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames, ...props, children });
925
830
  };
926
- var Textarea = React8__namespace.forwardRef(({ className, ...props }, ref) => {
831
+ var Textarea = React7__namespace.forwardRef(({ className, ...props }, ref) => {
927
832
  return /* @__PURE__ */ jsxRuntime.jsx(
928
833
  "textarea",
929
834
  {
@@ -937,7 +842,7 @@ var Textarea = React8__namespace.forwardRef(({ className, ...props }, ref) => {
937
842
  );
938
843
  });
939
844
  Textarea.displayName = "Textarea";
940
- var PromptInputContext = React8.createContext({
845
+ var PromptInputContext = React7.createContext({
941
846
  isLoading: false,
942
847
  value: "",
943
848
  setValue: () => {
@@ -948,7 +853,7 @@ var PromptInputContext = React8.createContext({
948
853
  textareaRef: { current: null }
949
854
  });
950
855
  function usePromptInput() {
951
- return React8.useContext(PromptInputContext);
856
+ return React7.useContext(PromptInputContext);
952
857
  }
953
858
  function PromptInput({
954
859
  className,
@@ -962,8 +867,8 @@ function PromptInput({
962
867
  onClick,
963
868
  ...props
964
869
  }) {
965
- const [internalValue, setInternalValue] = React8.useState(value || "");
966
- const textareaRef = React8.useRef(null);
870
+ const [internalValue, setInternalValue] = React7.useState(value || "");
871
+ const textareaRef = React7.useRef(null);
967
872
  const handleChange = (newValue) => {
968
873
  setInternalValue(newValue);
969
874
  onValueChange?.(newValue);
@@ -1020,7 +925,7 @@ function PromptInputTextarea({
1020
925
  textareaRef.current = el;
1021
926
  adjustHeight(el);
1022
927
  };
1023
- React8.useLayoutEffect(() => {
928
+ React7.useLayoutEffect(() => {
1024
929
  if (!textareaRef.current || disableAutosize) return;
1025
930
  const el = textareaRef.current;
1026
931
  el.style.height = "auto";
@@ -1087,7 +992,7 @@ function PromptInputAction({
1087
992
  }
1088
993
  var HoverCard = HoverCardPrimitive__namespace.Root;
1089
994
  var HoverCardTrigger = HoverCardPrimitive__namespace.Trigger;
1090
- var HoverCardContent = React8__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
995
+ var HoverCardContent = React7__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1091
996
  HoverCardPrimitive__namespace.Content,
1092
997
  {
1093
998
  ref,
@@ -1101,9 +1006,9 @@ var HoverCardContent = React8__namespace.forwardRef(({ className, align = "cente
1101
1006
  }
1102
1007
  ));
1103
1008
  HoverCardContent.displayName = HoverCardPrimitive__namespace.Content.displayName;
1104
- var SourceContext = React8.createContext(null);
1009
+ var SourceContext = React7.createContext(null);
1105
1010
  function useSourceContext() {
1106
- const ctx = React8.useContext(SourceContext);
1011
+ const ctx = React7.useContext(SourceContext);
1107
1012
  if (!ctx) throw new Error("Source.* must be used inside <Source>");
1108
1013
  return ctx;
1109
1014
  }
@@ -1187,11 +1092,11 @@ function SourceContent({
1187
1092
  }
1188
1093
  ) });
1189
1094
  }
1190
- var ReasoningContext = React8__namespace.createContext(
1095
+ var ReasoningContext = React7__namespace.createContext(
1191
1096
  null
1192
1097
  );
1193
1098
  function useReasoningContext() {
1194
- const context = React8__namespace.useContext(ReasoningContext);
1099
+ const context = React7__namespace.useContext(ReasoningContext);
1195
1100
  if (!context) {
1196
1101
  throw new Error(
1197
1102
  "Reasoning components must be used within a Reasoning provider"
@@ -1207,11 +1112,11 @@ function Reasoning({
1207
1112
  defaultOpen = false,
1208
1113
  className
1209
1114
  }) {
1210
- const [uncontrolledOpen, setUncontrolledOpen] = React8__namespace.useState(defaultOpen);
1211
- const prevStreamingRef = React8__namespace.useRef(isStreaming);
1115
+ const [uncontrolledOpen, setUncontrolledOpen] = React7__namespace.useState(defaultOpen);
1116
+ const prevStreamingRef = React7__namespace.useRef(isStreaming);
1212
1117
  const isControlled = controlledOpen !== void 0;
1213
1118
  const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
1214
- const setIsOpen = React8__namespace.useCallback(
1119
+ const setIsOpen = React7__namespace.useCallback(
1215
1120
  (open) => {
1216
1121
  if (onOpenChange) {
1217
1122
  onOpenChange(open);
@@ -1222,7 +1127,7 @@ function Reasoning({
1222
1127
  },
1223
1128
  [isControlled, onOpenChange]
1224
1129
  );
1225
- React8__namespace.useEffect(() => {
1130
+ React7__namespace.useEffect(() => {
1226
1131
  if (isStreaming && !prevStreamingRef.current) {
1227
1132
  setIsOpen(true);
1228
1133
  } else if (!isStreaming && prevStreamingRef.current) {
@@ -1278,9 +1183,9 @@ function ReasoningContent({
1278
1183
  className
1279
1184
  }) {
1280
1185
  const { isOpen } = useReasoningContext();
1281
- const contentRef = React8__namespace.useRef(null);
1282
- const [height, setHeight] = React8__namespace.useState(0);
1283
- React8__namespace.useEffect(() => {
1186
+ const contentRef = React7__namespace.useRef(null);
1187
+ const [height, setHeight] = React7__namespace.useState(0);
1188
+ React7__namespace.useEffect(() => {
1284
1189
  if (contentRef.current) {
1285
1190
  const resizeObserver = new ResizeObserver((entries) => {
1286
1191
  for (const entry of entries) {
@@ -1329,11 +1234,11 @@ function SimpleReasoning({
1329
1234
  /* @__PURE__ */ jsxRuntime.jsx(ReasoningContent, { markdown, children: content })
1330
1235
  ] });
1331
1236
  }
1332
- var CopilotUIContext = React8__namespace.createContext(
1237
+ var CopilotUIContext = React7__namespace.createContext(
1333
1238
  null
1334
1239
  );
1335
1240
  function useCopilotUI() {
1336
- const context = React8__namespace.useContext(CopilotUIContext);
1241
+ const context = React7__namespace.useContext(CopilotUIContext);
1337
1242
  if (!context) {
1338
1243
  return {
1339
1244
  debug: false,
@@ -1348,7 +1253,7 @@ function CopilotUIProvider({
1348
1253
  debug = false,
1349
1254
  defaultDebugExpanded = false
1350
1255
  }) {
1351
- const value = React8__namespace.useMemo(
1256
+ const value = React7__namespace.useMemo(
1352
1257
  () => ({
1353
1258
  debug,
1354
1259
  defaultDebugExpanded,
@@ -1490,7 +1395,7 @@ function ToolStep({
1490
1395
  }) {
1491
1396
  const { isDebug, defaultDebugExpanded } = useCopilotUI();
1492
1397
  const debug = debugProp ?? isDebug;
1493
- const [expanded, setExpanded] = React8__namespace.useState(
1398
+ const [expanded, setExpanded] = React7__namespace.useState(
1494
1399
  defaultExpanded ?? defaultDebugExpanded ?? false
1495
1400
  );
1496
1401
  const displayTitle = getDisplayTitle(step);
@@ -1955,9 +1860,9 @@ function ArrowUpRightIcon({ className }) {
1955
1860
  }
1956
1861
  );
1957
1862
  }
1958
- var ConfirmationContext = React8__namespace.createContext(null);
1863
+ var ConfirmationContext = React7__namespace.createContext(null);
1959
1864
  function useConfirmationContext() {
1960
- const context = React8__namespace.useContext(ConfirmationContext);
1865
+ const context = React7__namespace.useContext(ConfirmationContext);
1961
1866
  if (!context) {
1962
1867
  throw new Error(
1963
1868
  "Confirmation components must be used within a Confirmation provider"
@@ -2129,8 +2034,8 @@ function PermissionConfirmation({
2129
2034
  permissionOptions = DEFAULT_PERMISSION_OPTIONS,
2130
2035
  className
2131
2036
  }) {
2132
- const [selectedPermission, setSelectedPermission] = React8__namespace.useState("ask");
2133
- const [showOptions, setShowOptions] = React8__namespace.useState(false);
2037
+ const [selectedPermission, setSelectedPermission] = React7__namespace.useState("ask");
2038
+ const [showOptions, setShowOptions] = React7__namespace.useState(false);
2134
2039
  const handleApprove = () => {
2135
2040
  onApprove?.(selectedPermission);
2136
2041
  };
@@ -2260,7 +2165,7 @@ function CompactPermissionConfirmation({
2260
2165
  onReject,
2261
2166
  className
2262
2167
  }) {
2263
- const [rememberChoice, setRememberChoice] = React8__namespace.useState(false);
2168
+ const [rememberChoice, setRememberChoice] = React7__namespace.useState(false);
2264
2169
  const handleApprove = () => {
2265
2170
  onApprove?.(rememberChoice ? "allow_always" : "ask");
2266
2171
  };
@@ -2377,8 +2282,8 @@ function DevLogger({
2377
2282
  position = "bottom-right",
2378
2283
  className
2379
2284
  }) {
2380
- const [isOpen, setIsOpen] = React8.useState(false);
2381
- const [activeTab, setActiveTab] = React8.useState("chat");
2285
+ const [isOpen, setIsOpen] = React7.useState(false);
2286
+ const [activeTab, setActiveTab] = React7.useState("chat");
2382
2287
  const positionClasses = {
2383
2288
  "bottom-left": "bottom-4 left-4",
2384
2289
  "bottom-right": "bottom-4 right-4",
@@ -2803,9 +2708,9 @@ function ModelSelector({
2803
2708
  showCapabilities = true,
2804
2709
  className
2805
2710
  }) {
2806
- const [isOpen, setIsOpen] = React8__namespace.useState(false);
2807
- const containerRef = React8__namespace.useRef(null);
2808
- React8__namespace.useEffect(() => {
2711
+ const [isOpen, setIsOpen] = React7__namespace.useState(false);
2712
+ const containerRef = React7__namespace.useRef(null);
2713
+ React7__namespace.useEffect(() => {
2809
2714
  function handleClickOutside(event) {
2810
2715
  if (containerRef.current && !containerRef.current.contains(event.target)) {
2811
2716
  setIsOpen(false);
@@ -2814,7 +2719,7 @@ function ModelSelector({
2814
2719
  document.addEventListener("mousedown", handleClickOutside);
2815
2720
  return () => document.removeEventListener("mousedown", handleClickOutside);
2816
2721
  }, []);
2817
- const selectedModel = React8__namespace.useMemo(() => {
2722
+ const selectedModel = React7__namespace.useMemo(() => {
2818
2723
  if (!value) return null;
2819
2724
  if (providers) {
2820
2725
  for (const provider of providers) {
@@ -3040,7 +2945,7 @@ function PopoverTrigger({
3040
2945
  className,
3041
2946
  ...props
3042
2947
  }) {
3043
- if (asChild && React8__namespace.isValidElement(children)) {
2948
+ if (asChild && React7__namespace.isValidElement(children)) {
3044
2949
  return /* @__PURE__ */ jsxRuntime.jsx(popover.Popover.Trigger, { render: children, className, ...props });
3045
2950
  }
3046
2951
  return /* @__PURE__ */ jsxRuntime.jsx(popover.Popover.Trigger, { className, ...props, children });
@@ -3175,8 +3080,8 @@ function ThreadPicker({
3175
3080
  itemClassName,
3176
3081
  newButtonClassName
3177
3082
  }) {
3178
- const [isOpen, setIsOpen] = React8__namespace.useState(false);
3179
- const selectedThread = React8__namespace.useMemo(() => {
3083
+ const [isOpen, setIsOpen] = React7__namespace.useState(false);
3084
+ const selectedThread = React7__namespace.useMemo(() => {
3180
3085
  if (!value) return null;
3181
3086
  return threads.find((t) => t.id === value) ?? null;
3182
3087
  }, [value, threads]);
@@ -3382,7 +3287,7 @@ function ThreadCard({
3382
3287
  showDelete = true,
3383
3288
  className
3384
3289
  }) {
3385
- const [isHovered, setIsHovered] = React8__namespace.useState(false);
3290
+ const [isHovered, setIsHovered] = React7__namespace.useState(false);
3386
3291
  const handleDelete = (e) => {
3387
3292
  e.stopPropagation();
3388
3293
  onDelete?.();
@@ -3633,7 +3538,7 @@ function DefaultMessage({
3633
3538
  }) {
3634
3539
  const isUser = message.role === "user";
3635
3540
  const isStreaming = isLastMessage && isLoading;
3636
- const { cleanContent, followUps } = React8__namespace.useMemo(() => {
3541
+ const { cleanContent, followUps } = React7__namespace.useMemo(() => {
3637
3542
  if (isUser || !message.content) {
3638
3543
  return { cleanContent: message.content, followUps: [] };
3639
3544
  }
@@ -3771,7 +3676,7 @@ function DefaultMessage({
3771
3676
  toolName: exec.name
3772
3677
  };
3773
3678
  const output = toolDef.render(renderProps);
3774
- return /* @__PURE__ */ jsxRuntime.jsx(React8__namespace.Fragment, { children: output }, exec.id);
3679
+ return /* @__PURE__ */ jsxRuntime.jsx(React7__namespace.Fragment, { children: output }, exec.id);
3775
3680
  }
3776
3681
  return null;
3777
3682
  }) }),
@@ -3807,7 +3712,7 @@ function DefaultMessage({
3807
3712
  approval: approvalCallbacks
3808
3713
  };
3809
3714
  const output = toolDef.render(renderProps);
3810
- return /* @__PURE__ */ jsxRuntime.jsx(React8__namespace.Fragment, { children: output }, tool.id);
3715
+ return /* @__PURE__ */ jsxRuntime.jsx(React7__namespace.Fragment, { children: output }, tool.id);
3811
3716
  }
3812
3717
  return /* @__PURE__ */ jsxRuntime.jsx(
3813
3718
  PermissionConfirmation,
@@ -3839,7 +3744,7 @@ function DefaultMessage({
3839
3744
  ] });
3840
3745
  }
3841
3746
  function AttachmentPreview({ attachment }) {
3842
- const [expanded, setExpanded] = React8__namespace.useState(false);
3747
+ const [expanded, setExpanded] = React7__namespace.useState(false);
3843
3748
  if (attachment.type !== "image") {
3844
3749
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 rounded-lg border bg-muted/50 px-3 py-2 text-sm", children: [
3845
3750
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: attachment.type }),
@@ -3968,10 +3873,10 @@ function ChatWelcome({
3968
3873
  processAttachment: processAttachmentProp,
3969
3874
  classNames = {}
3970
3875
  }) {
3971
- const [input, setInput] = React8.useState("");
3972
- const [pendingAttachments, setPendingAttachments] = React8.useState([]);
3973
- const fileInputRef = React8.useRef(null);
3974
- const fileInputId = React8.useId();
3876
+ const [input, setInput] = React7.useState("");
3877
+ const [pendingAttachments, setPendingAttachments] = React7.useState([]);
3878
+ const fileInputRef = React7.useRef(null);
3879
+ const fileInputId = React7.useId();
3975
3880
  const title = config?.title ?? DEFAULT_TITLE;
3976
3881
  const subtitle = config?.subtitle ?? DEFAULT_SUBTITLE;
3977
3882
  const logo = config?.logo;
@@ -3980,7 +3885,7 @@ function ChatWelcome({
3980
3885
  config?.recentChatsLabel ?? DEFAULT_RECENT_CHATS_LABEL;
3981
3886
  const maxRecentChats = config?.maxRecentChats ?? DEFAULT_MAX_RECENT_CHATS;
3982
3887
  config?.viewMoreLabel ?? DEFAULT_VIEW_MORE_LABEL;
3983
- const isFileTypeAllowed = React8.useCallback(
3888
+ const isFileTypeAllowed = React7.useCallback(
3984
3889
  (file) => {
3985
3890
  for (const type of allowedFileTypes) {
3986
3891
  if (type.endsWith("/*")) {
@@ -3994,7 +3899,7 @@ function ChatWelcome({
3994
3899
  },
3995
3900
  [allowedFileTypes]
3996
3901
  );
3997
- const handleFileSelect = React8.useCallback(
3902
+ const handleFileSelect = React7.useCallback(
3998
3903
  async (files) => {
3999
3904
  if (!files || !attachmentsEnabled) return;
4000
3905
  for (const file of Array.from(files)) {
@@ -4057,7 +3962,7 @@ function ChatWelcome({
4057
3962
  },
4058
3963
  [attachmentsEnabled, maxFileSize, isFileTypeAllowed, processAttachmentProp]
4059
3964
  );
4060
- const handleInputChange = React8.useCallback(
3965
+ const handleInputChange = React7.useCallback(
4061
3966
  (e) => {
4062
3967
  handleFileSelect(e.target.files);
4063
3968
  if (fileInputRef.current) {
@@ -4066,7 +3971,7 @@ function ChatWelcome({
4066
3971
  },
4067
3972
  [handleFileSelect]
4068
3973
  );
4069
- const removePendingAttachment = React8.useCallback((id) => {
3974
+ const removePendingAttachment = React7.useCallback((id) => {
4070
3975
  setPendingAttachments((prev) => {
4071
3976
  const att = prev.find((a) => a.id === id);
4072
3977
  if (att) {
@@ -4075,7 +3980,7 @@ function ChatWelcome({
4075
3980
  return prev.filter((a) => a.id !== id);
4076
3981
  });
4077
3982
  }, []);
4078
- const handleSubmit = React8.useCallback(() => {
3983
+ const handleSubmit = React7.useCallback(() => {
4079
3984
  const hasContent = input.trim();
4080
3985
  const hasAttachments = pendingAttachments.some(
4081
3986
  (att) => att.status === "ready"
@@ -4087,7 +3992,7 @@ function ChatWelcome({
4087
3992
  setPendingAttachments([]);
4088
3993
  setInput("");
4089
3994
  }, [input, isLoading, onSendMessage, pendingAttachments]);
4090
- const handleSuggestionClick = React8.useCallback(
3995
+ const handleSuggestionClick = React7.useCallback(
4091
3996
  (suggestion) => {
4092
3997
  onSendMessage(suggestion);
4093
3998
  },
@@ -4342,12 +4247,12 @@ function Chat({
4342
4247
  className,
4343
4248
  classNames = {}
4344
4249
  }) {
4345
- const [input, setInput] = React8.useState("");
4346
- const [pendingAttachments, setPendingAttachments] = React8.useState([]);
4347
- const [isDragging, setIsDragging] = React8.useState(false);
4348
- const fileInputRef = React8.useRef(null);
4349
- const fileInputId = React8.useId();
4350
- const isFileTypeAllowed = React8.useCallback(
4250
+ const [input, setInput] = React7.useState("");
4251
+ const [pendingAttachments, setPendingAttachments] = React7.useState([]);
4252
+ const [isDragging, setIsDragging] = React7.useState(false);
4253
+ const fileInputRef = React7.useRef(null);
4254
+ const fileInputId = React7.useId();
4255
+ const isFileTypeAllowed = React7.useCallback(
4351
4256
  (file) => {
4352
4257
  for (const type of allowedFileTypes) {
4353
4258
  if (type.endsWith("/*")) {
@@ -4361,7 +4266,7 @@ function Chat({
4361
4266
  },
4362
4267
  [allowedFileTypes]
4363
4268
  );
4364
- const handleFileSelect = React8.useCallback(
4269
+ const handleFileSelect = React7.useCallback(
4365
4270
  async (files) => {
4366
4271
  if (!files || !attachmentsEnabled) return;
4367
4272
  for (const file of Array.from(files)) {
@@ -4424,7 +4329,7 @@ function Chat({
4424
4329
  },
4425
4330
  [attachmentsEnabled, maxFileSize, isFileTypeAllowed, processAttachmentProp]
4426
4331
  );
4427
- const handleInputChange = React8.useCallback(
4332
+ const handleInputChange = React7.useCallback(
4428
4333
  (e) => {
4429
4334
  handleFileSelect(e.target.files);
4430
4335
  if (fileInputRef.current) {
@@ -4433,7 +4338,7 @@ function Chat({
4433
4338
  },
4434
4339
  [handleFileSelect]
4435
4340
  );
4436
- const removePendingAttachment = React8.useCallback((id) => {
4341
+ const removePendingAttachment = React7.useCallback((id) => {
4437
4342
  setPendingAttachments((prev) => {
4438
4343
  const att = prev.find((a) => a.id === id);
4439
4344
  if (att) {
@@ -4442,7 +4347,7 @@ function Chat({
4442
4347
  return prev.filter((a) => a.id !== id);
4443
4348
  });
4444
4349
  }, []);
4445
- const handleDragOver = React8.useCallback(
4350
+ const handleDragOver = React7.useCallback(
4446
4351
  (e) => {
4447
4352
  e.preventDefault();
4448
4353
  e.stopPropagation();
@@ -4452,12 +4357,12 @@ function Chat({
4452
4357
  },
4453
4358
  [attachmentsEnabled]
4454
4359
  );
4455
- const handleDragLeave = React8.useCallback((e) => {
4360
+ const handleDragLeave = React7.useCallback((e) => {
4456
4361
  e.preventDefault();
4457
4362
  e.stopPropagation();
4458
4363
  setIsDragging(false);
4459
4364
  }, []);
4460
- const handleDrop = React8.useCallback(
4365
+ const handleDrop = React7.useCallback(
4461
4366
  (e) => {
4462
4367
  e.preventDefault();
4463
4368
  e.stopPropagation();
@@ -4468,7 +4373,7 @@ function Chat({
4468
4373
  },
4469
4374
  [attachmentsEnabled, handleFileSelect]
4470
4375
  );
4471
- const handleSubmit = React8.useCallback(() => {
4376
+ const handleSubmit = React7.useCallback(() => {
4472
4377
  const hasContent = input.trim();
4473
4378
  const hasAttachments = pendingAttachments.some(
4474
4379
  (att) => att.status === "ready"
@@ -4480,7 +4385,7 @@ function Chat({
4480
4385
  setPendingAttachments([]);
4481
4386
  setInput("");
4482
4387
  }, [input, isLoading, onSendMessage, pendingAttachments]);
4483
- const handleSuggestionClick = React8.useCallback(
4388
+ const handleSuggestionClick = React7.useCallback(
4484
4389
  (suggestion) => {
4485
4390
  if (onSuggestionClick) {
4486
4391
  onSuggestionClick(suggestion);
@@ -4590,7 +4495,7 @@ function Chat({
4590
4495
  onSendMessage?.(question);
4591
4496
  }
4592
4497
  };
4593
- return renderMessage ? /* @__PURE__ */ jsxRuntime.jsx(React8__namespace.default.Fragment, { children: renderMessage(messageWithExecutions, index) }, message.id) : /* @__PURE__ */ jsxRuntime.jsx(
4498
+ return renderMessage ? /* @__PURE__ */ jsxRuntime.jsx(React7__namespace.default.Fragment, { children: renderMessage(messageWithExecutions, index) }, message.id) : /* @__PURE__ */ jsxRuntime.jsx(
4594
4499
  DefaultMessage,
4595
4500
  {
4596
4501
  message: messageWithExecutions,
@@ -4926,17 +4831,17 @@ function useInternalThreadManager(config = {}) {
4926
4831
  refreshThreads
4927
4832
  } = threadManager;
4928
4833
  const { messages, setMessages, status, isLoading } = chunkMHLF2QXY_cjs.useCopilot();
4929
- const isLoadingMessagesRef = React8.useRef(false);
4930
- const savingToThreadRef = React8.useRef(null);
4931
- const lastSavedSnapshotRef = React8.useRef("");
4932
- const hasInitializedRef = React8.useRef(false);
4933
- const getMessageSnapshot = React8.useCallback((msgs) => {
4834
+ const isLoadingMessagesRef = React7.useRef(false);
4835
+ const savingToThreadRef = React7.useRef(null);
4836
+ const lastSavedSnapshotRef = React7.useRef("");
4837
+ const hasInitializedRef = React7.useRef(false);
4838
+ const getMessageSnapshot = React7.useCallback((msgs) => {
4934
4839
  return msgs.map((m) => {
4935
4840
  const contentPreview = (m.content ?? "").slice(0, 20);
4936
4841
  return `${m.id}:${contentPreview}:${m.content?.length ?? 0}`;
4937
4842
  }).join("|");
4938
4843
  }, []);
4939
- const convertToCore = React8.useCallback((msgs) => {
4844
+ const convertToCore = React7.useCallback((msgs) => {
4940
4845
  return msgs.map((m) => ({
4941
4846
  id: m.id,
4942
4847
  role: m.role,
@@ -4950,7 +4855,7 @@ function useInternalThreadManager(config = {}) {
4950
4855
  }
4951
4856
  }));
4952
4857
  }, []);
4953
- const handleSwitchThread = React8.useCallback(
4858
+ const handleSwitchThread = React7.useCallback(
4954
4859
  async (threadId) => {
4955
4860
  isLoadingMessagesRef.current = true;
4956
4861
  const thread = await switchThread(threadId);
@@ -4979,7 +4884,7 @@ function useInternalThreadManager(config = {}) {
4979
4884
  },
4980
4885
  [switchThread, setMessages, getMessageSnapshot, onThreadChange]
4981
4886
  );
4982
- const handleNewThread = React8.useCallback(async () => {
4887
+ const handleNewThread = React7.useCallback(async () => {
4983
4888
  isLoadingMessagesRef.current = true;
4984
4889
  clearCurrentThread();
4985
4890
  lastSavedSnapshotRef.current = "";
@@ -4990,7 +4895,7 @@ function useInternalThreadManager(config = {}) {
4990
4895
  isLoadingMessagesRef.current = false;
4991
4896
  });
4992
4897
  }, [clearCurrentThread, setMessages, onThreadChange]);
4993
- React8.useEffect(() => {
4898
+ React7.useEffect(() => {
4994
4899
  if (hasInitializedRef.current || !currentThread) {
4995
4900
  return;
4996
4901
  }
@@ -5018,7 +4923,7 @@ function useInternalThreadManager(config = {}) {
5018
4923
  isLoadingMessagesRef.current = false;
5019
4924
  });
5020
4925
  }, [currentThread, setMessages, getMessageSnapshot, onThreadChange]);
5021
- React8.useEffect(() => {
4926
+ React7.useEffect(() => {
5022
4927
  if (isLoadingMessagesRef.current) {
5023
4928
  return;
5024
4929
  }
@@ -5258,7 +5163,7 @@ function CopilotChat(props) {
5258
5163
  footer: classNames.footer
5259
5164
  } : void 0;
5260
5165
  const { threadManager, handleSwitchThread, handleNewThread, isBusy } = threadManagerResult;
5261
- const handleDeleteThread = React8__namespace.default.useCallback(
5166
+ const handleDeleteThread = React7__namespace.default.useCallback(
5262
5167
  (threadId) => {
5263
5168
  const isCurrentThread = threadManager.currentThreadId === threadId;
5264
5169
  threadManager.deleteThread(threadId);