@copilotkit/react-core 2.0.0-rc.19 → 2.0.0-rc.20

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/index.umd.js CHANGED
@@ -74,28 +74,6 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
74
74
  }
75
75
  StreamingMarkdownDefaultRenderer.displayName = "StreamingMarkdownDefaultRenderer";
76
76
 
77
- //#endregion
78
- //#region src/lib/utils.ts
79
- /**
80
- * Joins class names, skipping falsy values. Takes the same inputs as `clsx`.
81
- * Classes are not merged: every rule CopilotKit ships sits in `:where()`, so a
82
- * class the app adds wins without removing ours.
83
- */
84
- function cn(...inputs) {
85
- const out = [];
86
- for (const input of inputs) {
87
- if (!input) continue;
88
- if (typeof input === "string" || typeof input === "number" || typeof input === "bigint") out.push(String(input));
89
- else if (Array.isArray(input)) {
90
- const nested = cn(...input);
91
- if (nested) out.push(nested);
92
- } else if (typeof input === "object") {
93
- for (const key in input) if (input[key]) out.push(key);
94
- }
95
- }
96
- return out.join(" ");
97
- }
98
-
99
77
  //#endregion
100
78
  //#region src/components/icons/CopilotIcon.tsx
101
79
  /** Turns SVG attribute names such as `stroke-width` into React's `strokeWidth`. */
@@ -121,7 +99,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
121
99
  height: size,
122
100
  stroke: color,
123
101
  strokeWidth,
124
- className: cn("lucide", `lucide-${lucideName}`, className),
102
+ className: (0, _copilotkit_core.ɵcn)("lucide", `lucide-${lucideName}`, className),
125
103
  "aria-hidden": isDecorative || void 0,
126
104
  ...props,
127
105
  children: [nodes.map((node, index) => (0, react.createElement)(node.tag, {
@@ -333,14 +311,11 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
333
311
  //#endregion
334
312
  //#region src/lib/shallow-stable-ref.ts
335
313
  /**
336
- * Shallow equality comparison for objects.
314
+ * Shallow equality comparison for objects: same own keys, each holding the
315
+ * same value (`Object.is`). Core's `ɵshallowEqualRecord` holds the rule.
337
316
  */
338
317
  function shallowEqual(obj1, obj2) {
339
- const keys1 = Object.keys(obj1);
340
- const keys2 = Object.keys(obj2);
341
- if (keys1.length !== keys2.length) return false;
342
- for (const key of keys1) if (obj1[key] !== obj2[key]) return false;
343
- return true;
318
+ return (0, _copilotkit_core.ɵshallowEqualRecord)(obj1, obj2);
344
319
  }
345
320
  /**
346
321
  * Returns true only for plain JS objects (`{}`), excluding arrays, Dates,
@@ -656,7 +631,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
656
631
  * followed by `className`.
657
632
  */
658
633
  function buttonVariants({ variant, size, className, class: classProp } = {}) {
659
- return cn("cpk-button", variant !== null && variantClasses[variant ?? "default"], size !== null && sizeClasses[size ?? "default"], classProp, className);
634
+ return (0, _copilotkit_core.ɵcn)("cpk-button", variant !== null && variantClasses[variant ?? "default"], size !== null && sizeClasses[size ?? "default"], classProp, className);
660
635
  }
661
636
  const Button = react.forwardRef(function Button({ className, variant, size, ...props }, ref) {
662
637
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
@@ -698,7 +673,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
698
673
  "data-copilotkit": true,
699
674
  "data-slot": "tooltip-content",
700
675
  sideOffset,
701
- className: cn("cpk-tooltip", className),
676
+ className: (0, _copilotkit_core.ɵcn)("cpk-tooltip", className),
702
677
  ...props,
703
678
  children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tooltip.Arrow, { className: "cpk-tooltip-arrow" })]
704
679
  }) });
@@ -724,7 +699,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
724
699
  "data-copilotkit": true,
725
700
  "data-slot": "dropdown-menu-content",
726
701
  sideOffset,
727
- className: cn("cpk-dropdown-menu-content", className),
702
+ className: (0, _copilotkit_core.ɵcn)("cpk-dropdown-menu-content", className),
728
703
  ...props
729
704
  }) });
730
705
  }
@@ -733,7 +708,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
733
708
  "data-slot": "dropdown-menu-item",
734
709
  "data-inset": inset,
735
710
  "data-variant": variant,
736
- className: cn("cpk-dropdown-menu-item", className),
711
+ className: (0, _copilotkit_core.ɵcn)("cpk-dropdown-menu-item", className),
737
712
  ...props
738
713
  });
739
714
  }
@@ -741,14 +716,14 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
741
716
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Label, {
742
717
  "data-slot": "dropdown-menu-label",
743
718
  "data-inset": inset,
744
- className: cn("cpk-dropdown-menu-label", className),
719
+ className: (0, _copilotkit_core.ɵcn)("cpk-dropdown-menu-label", className),
745
720
  ...props
746
721
  });
747
722
  }
748
723
  function DropdownMenuSeparator({ className, ...props }) {
749
724
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Separator, {
750
725
  "data-slot": "dropdown-menu-separator",
751
- className: cn("cpk-dropdown-menu-separator", className),
726
+ className: (0, _copilotkit_core.ɵcn)("cpk-dropdown-menu-separator", className),
752
727
  ...props
753
728
  });
754
729
  }
@@ -762,7 +737,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
762
737
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dropdown_menu.SubTrigger, {
763
738
  "data-slot": "dropdown-menu-sub-trigger",
764
739
  "data-inset": inset,
765
- className: cn("cpk-dropdown-menu-sub-trigger", className),
740
+ className: (0, _copilotkit_core.ɵcn)("cpk-dropdown-menu-sub-trigger", className),
766
741
  ...props,
767
742
  children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotIcon, {
768
743
  name: "ChevronRight",
@@ -773,7 +748,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
773
748
  function DropdownMenuSubContent({ className, ...props }) {
774
749
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.SubContent, {
775
750
  "data-slot": "dropdown-menu-sub-content",
776
- className: cn("cpk-dropdown-menu-sub-content", className),
751
+ className: (0, _copilotkit_core.ɵcn)("cpk-dropdown-menu-sub-content", className),
777
752
  ...props
778
753
  });
779
754
  }
@@ -968,7 +943,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
968
943
  cleanup
969
944
  ]);
970
945
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
971
- className: cn("cpk-audio-recorder", className),
946
+ className: (0, _copilotkit_core.ɵcn)("cpk-audio-recorder", className),
972
947
  ...divProps,
973
948
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("canvas", {
974
949
  ref: canvasRef,
@@ -996,7 +971,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
996
971
  const existingClassName = props.className;
997
972
  return react.default.createElement(DefaultComponent, {
998
973
  ...props,
999
- className: cn(existingClassName, slot)
974
+ className: (0, _copilotkit_core.ɵcn)(existingClassName, slot)
1000
975
  });
1001
976
  }
1002
977
  if (isReactComponentType(slot)) return react.default.createElement(slot, props);
@@ -1589,7 +1564,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
1589
1564
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1590
1565
  "data-copilotkit": true,
1591
1566
  ref: containerRef,
1592
- className: cn("cpk-chat-input", positioning === "absolute" && "cpk-chat-input-absolute", className),
1567
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-input", positioning === "absolute" && "cpk-chat-input-absolute", className),
1593
1568
  style: {
1594
1569
  transform: keyboardHeight > 0 ? `translateY(-${keyboardHeight}px)` : void 0,
1595
1570
  transition: "transform 0.2s ease-out",
@@ -1612,7 +1587,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
1612
1587
  "data-testid": "copilot-send-button",
1613
1588
  variant: "chatInputToolbarPrimary",
1614
1589
  size: "chatInputToolbarIcon",
1615
- className: cn("cpk-chat-input-send-button", className),
1590
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-input-send-button", className),
1616
1591
  "aria-label": labels.chatInputToolbarSendButtonLabel,
1617
1592
  ...props,
1618
1593
  children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotIcon, {
@@ -1630,7 +1605,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
1630
1605
  type: "button",
1631
1606
  variant: "chatInputToolbarSecondary",
1632
1607
  size: "chatInputToolbarIcon",
1633
- className: cn(defaultClassName, className),
1608
+ className: (0, _copilotkit_core.ɵcn)(defaultClassName, className),
1634
1609
  "aria-label": labels[labelKey],
1635
1610
  ...props,
1636
1611
  children: icon
@@ -1709,7 +1684,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
1709
1684
  "data-testid": "copilot-add-menu-button",
1710
1685
  variant: "chatInputToolbarSecondary",
1711
1686
  size: "chatInputToolbarIcon",
1712
- className: cn("cpk-chat-input-add-menu-button", className),
1687
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-input-add-menu-button", className),
1713
1688
  disabled: isDisabled,
1714
1689
  "aria-label": labels.chatInputToolbarAddButtonLabel,
1715
1690
  ...props,
@@ -1751,7 +1726,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
1751
1726
  ref: internalTextareaRef,
1752
1727
  "data-testid": "copilot-chat-textarea",
1753
1728
  placeholder: placeholder ?? labels.chatInputPlaceholder,
1754
- className: cn("cpk-chat-input-textarea", className),
1729
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-input-textarea", className),
1755
1730
  style: {
1756
1731
  overflow: "auto",
1757
1732
  resize: "none",
@@ -1765,7 +1740,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
1765
1740
  _CopilotChatInput.Disclaimer = ({ className, ...props }) => {
1766
1741
  const labels = useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
1767
1742
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1768
- className: cn("cpk-chat-input-disclaimer", className),
1743
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-input-disclaimer", className),
1769
1744
  ...props,
1770
1745
  children: labels.chatDisclaimerText
1771
1746
  });
@@ -1923,7 +1898,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
1923
1898
 
1924
1899
  //#endregion
1925
1900
  //#region package.json
1926
- var version$1 = "2.0.0-rc.19";
1901
+ var version$1 = "2.0.0-rc.20";
1927
1902
 
1928
1903
  //#endregion
1929
1904
  //#region src/components/CopilotKitInspector.tsx
@@ -1994,164 +1969,51 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
1994
1969
 
1995
1970
  //#endregion
1996
1971
  //#region src/components/license-warning-banner.tsx
1997
- const labels = _copilotkit_core.CopilotChatDefaultLabels;
1972
+ /** The chat labels in effect, or the default ones outside a chat. */
1973
+ function useLabels$2() {
1974
+ return useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
1975
+ }
1998
1976
  /**
1999
- * The "expires soon" banner text. Without a day count it says "soon", never
2000
- * "in undefined days".
1977
+ * The fixed license banner. Core's `ɵgetLicenseBannerSpec` picks its text,
1978
+ * link, and severity; this component renders them.
2001
1979
  */
2002
- function expiringMessage(graceRemaining) {
2003
- if (graceRemaining === void 0) return labels.licenseExpiringText;
2004
- return (0, _copilotkit_core.ɵformatLabel)(graceRemaining === 1 ? labels.licenseExpiringInDaysOne : labels.licenseExpiringInDaysOther, { days: graceRemaining });
2005
- }
2006
- const LICENSE_BANNER_OFFSET_PX = 52;
2007
- const LICENSE_BANNER_OFFSET_VAR = "--copilotkit-license-banner-offset";
2008
- const BANNER_STYLES = {
2009
- base: {
2010
- position: "fixed",
2011
- bottom: "8px",
2012
- left: "50%",
2013
- transform: "translateX(-50%)",
2014
- zIndex: 99999,
2015
- display: "inline-flex",
2016
- alignItems: "center",
2017
- gap: "12px",
2018
- whiteSpace: "nowrap",
2019
- padding: "8px 16px",
2020
- fontSize: "13px",
2021
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif",
2022
- borderRadius: "6px",
2023
- boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)"
2024
- },
2025
- info: {
2026
- backgroundColor: "#eff6ff",
2027
- border: "1px solid #93c5fd",
2028
- color: "#1e40af"
2029
- },
2030
- warning: {
2031
- backgroundColor: "#fffbeb",
2032
- border: "1px solid #fbbf24",
2033
- color: "#92400e"
2034
- },
2035
- critical: {
2036
- backgroundColor: "#fef2f2",
2037
- border: "1px solid #fca5a5",
2038
- color: "#991b1b"
2039
- }
2040
- };
2041
- function getSeverityStyle(severity) {
2042
- switch (severity) {
2043
- case "warning": return BANNER_STYLES.warning;
2044
- case "critical": return BANNER_STYLES.critical;
2045
- default: return BANNER_STYLES.info;
2046
- }
2047
- }
2048
- function BannerShell({ severity, message, actionLabel, actionUrl, onDismiss }) {
2049
- (0, react.useEffect)(() => {
2050
- if (typeof document === "undefined") return;
2051
- const root = document.documentElement;
2052
- root.style.setProperty(LICENSE_BANNER_OFFSET_VAR, `${LICENSE_BANNER_OFFSET_PX}px`);
2053
- return () => {
2054
- root.style.removeProperty(LICENSE_BANNER_OFFSET_VAR);
2055
- };
2056
- }, []);
1980
+ function LicenseWarningBanner({ type, onDismiss, ...details }) {
1981
+ const spec = (0, _copilotkit_core.ɵgetLicenseBannerSpec)(type, useLabels$2(), details);
1982
+ (0, react.useEffect)(() => (0, _copilotkit_core.ɵreserveLicenseBannerOffset)(), []);
2057
1983
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2058
1984
  style: {
2059
- ...BANNER_STYLES.base,
2060
- ...getSeverityStyle(severity)
1985
+ ..._copilotkit_core.ɵLICENSE_BANNER_STYLE.base,
1986
+ ..._copilotkit_core.ɵLICENSE_BANNER_STYLE.severity[spec.severity]
2061
1987
  },
2062
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: message }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2063
- style: {
2064
- display: "flex",
2065
- gap: "8px",
2066
- alignItems: "center"
2067
- },
1988
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: spec.message }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1989
+ style: _copilotkit_core.ɵLICENSE_BANNER_STYLE.actions,
2068
1990
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
2069
- href: actionUrl,
1991
+ href: spec.actionUrl,
2070
1992
  target: "_blank",
2071
1993
  rel: "noopener noreferrer",
2072
- style: {
2073
- fontWeight: 600,
2074
- textDecoration: "underline",
2075
- color: "inherit"
2076
- },
2077
- children: actionLabel
1994
+ style: _copilotkit_core.ɵLICENSE_BANNER_STYLE.link,
1995
+ children: spec.actionLabel
2078
1996
  }), onDismiss && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2079
1997
  onClick: onDismiss,
2080
- style: {
2081
- background: "none",
2082
- border: "none",
2083
- cursor: "pointer",
2084
- color: "inherit",
2085
- fontSize: "16px"
2086
- },
1998
+ style: _copilotkit_core.ɵLICENSE_BANNER_STYLE.dismiss,
2087
1999
  children: "×"
2088
2000
  })]
2089
2001
  })]
2090
2002
  });
2091
2003
  }
2092
- function LicenseWarningBanner({ type, featureName, expiryDate, graceRemaining, onDismiss }) {
2093
- switch (type) {
2094
- case "no_license": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerShell, {
2095
- severity: "info",
2096
- message: labels.licensePoweredByText,
2097
- actionLabel: labels.licenseGetLicenseLabel,
2098
- actionUrl: "https://copilotkit.ai/pricing",
2099
- onDismiss
2100
- });
2101
- case "feature_unlicensed": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerShell, {
2102
- severity: "warning",
2103
- message: (0, _copilotkit_core.ɵformatLabel)(labels.licenseFeatureUnlicensedText, { feature: featureName ?? "" }),
2104
- actionLabel: labels.licenseGetLicenseLabel,
2105
- actionUrl: "https://copilotkit.ai/pricing",
2106
- onDismiss
2107
- });
2108
- case "expiring": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerShell, {
2109
- severity: "warning",
2110
- message: expiringMessage(graceRemaining),
2111
- actionLabel: labels.licenseRenewLabel,
2112
- actionUrl: "https://dashboard.operations.copilotkit.ai",
2113
- onDismiss
2114
- });
2115
- case "expired": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerShell, {
2116
- severity: "critical",
2117
- message: expiryDate ? (0, _copilotkit_core.ɵformatLabel)(labels.licenseExpiredOnDateText, { date: expiryDate }) : labels.licenseExpiredText,
2118
- actionLabel: labels.licenseRenewNowLabel,
2119
- actionUrl: "https://copilotkit.ai/pricing",
2120
- onDismiss
2121
- });
2122
- case "invalid": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerShell, {
2123
- severity: "critical",
2124
- message: labels.licenseInvalidText,
2125
- actionLabel: labels.licenseGetLicenseLabel,
2126
- actionUrl: "https://copilotkit.ai/pricing",
2127
- onDismiss
2128
- });
2129
- default: return null;
2130
- }
2131
- }
2132
2004
  function InlineFeatureWarning({ featureName }) {
2005
+ const spec = (0, _copilotkit_core.ɵgetInlineFeatureWarningSpec)(featureName, useLabels$2());
2133
2006
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2134
- style: {
2135
- padding: "8px 12px",
2136
- backgroundColor: "#fffbeb",
2137
- border: "1px solid #fbbf24",
2138
- borderRadius: "6px",
2139
- fontSize: "13px",
2140
- color: "#92400e",
2141
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif"
2142
- },
2007
+ style: _copilotkit_core.ɵINLINE_FEATURE_WARNING_STYLE.container,
2143
2008
  children: [
2144
- (0, _copilotkit_core.ɵformatLabel)(labels.licenseFeatureUnlicensedText, { feature: featureName }),
2009
+ spec.message,
2145
2010
  " ",
2146
2011
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
2147
- href: "https://copilotkit.ai/pricing",
2012
+ href: spec.actionUrl,
2148
2013
  target: "_blank",
2149
2014
  rel: "noopener noreferrer",
2150
- style: {
2151
- color: "#b45309",
2152
- textDecoration: "underline"
2153
- },
2154
- children: "Get one at copilotkit.ai/pricing"
2015
+ style: _copilotkit_core.ɵINLINE_FEATURE_WARNING_STYLE.link,
2016
+ children: spec.actionLabel
2155
2017
  })
2156
2018
  ]
2157
2019
  });
@@ -8769,7 +8631,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
8769
8631
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8770
8632
  ref,
8771
8633
  id,
8772
- className: cn("cpk-collapsible", className),
8634
+ className: (0, _copilotkit_core.ɵcn)("cpk-collapsible", className),
8773
8635
  style: { gridTemplateRows: open ? "1fr" : "0fr" },
8774
8636
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8775
8637
  className: "cpk-collapsible-content",
@@ -8781,14 +8643,14 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
8781
8643
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotIcon, {
8782
8644
  name: STATUS_ICONS[status],
8783
8645
  "aria-hidden": "true",
8784
- className: cn("cpk-tool-call-status-icon", status === "running" && "cpk-tool-call-status-icon-running", status === "failed" && "cpk-tool-call-status-icon-failed", className)
8646
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-status-icon", status === "running" && "cpk-tool-call-status-icon-running", status === "failed" && "cpk-tool-call-status-icon-failed", className)
8785
8647
  });
8786
8648
  }
8787
8649
  function Chevron({ open, className }) {
8788
8650
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotIcon, {
8789
8651
  name: "ChevronRight",
8790
8652
  "aria-hidden": "true",
8791
- className: cn("cpk-tool-call-chevron", open && "cpk-tool-call-chevron-open", className)
8653
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-chevron", open && "cpk-tool-call-chevron-open", className)
8792
8654
  });
8793
8655
  }
8794
8656
  function FailedCount({ calls }) {
@@ -8816,7 +8678,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
8816
8678
  function ToolCallPayloads({ parameters, result, className }) {
8817
8679
  const labels = useLabels$1();
8818
8680
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8819
- className: cn("cpk-tool-call-payloads", className),
8681
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-payloads", className),
8820
8682
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Payload, {
8821
8683
  label: labels.toolCallArgumentsLabel,
8822
8684
  value: parameters ?? {}
@@ -8838,7 +8700,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
8838
8700
  const preview = (0, _copilotkit_core.ɵgetArgumentPreview)(parameters);
8839
8701
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8840
8702
  "data-copilotkit": true,
8841
- className: cn("cpk-tool-call-row", `cpk-tool-call-row-${appearance}`, className),
8703
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-row", `cpk-tool-call-row-${appearance}`, className),
8842
8704
  ...props,
8843
8705
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
8844
8706
  type: "button",
@@ -8850,7 +8712,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
8850
8712
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusIcon, { status }),
8851
8713
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8852
8714
  "data-testid": "copilot-tool-render-name",
8853
- className: cn("cpk-tool-call-row-name", status === "running" && "cpk-shimmer"),
8715
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-row-name", status === "running" && "cpk-shimmer"),
8854
8716
  children: name
8855
8717
  }),
8856
8718
  preview && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -8925,7 +8787,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
8925
8787
  if (appearance === "line") {
8926
8788
  if (calls.length === 1 && !current) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8927
8789
  ...groupProps,
8928
- className: cn("cpk-tool-call-group cpk-tool-call-group-line cpk-tool-call-group-single", className),
8790
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-group cpk-tool-call-group-line cpk-tool-call-group-single", className),
8929
8791
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolCallGroupContext.Provider, {
8930
8792
  value: {
8931
8793
  appearance: "line",
@@ -8937,7 +8799,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
8937
8799
  });
8938
8800
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8939
8801
  ...groupProps,
8940
- className: cn("cpk-tool-call-group cpk-tool-call-group-line", className),
8802
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-group cpk-tool-call-group-line", className),
8941
8803
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
8942
8804
  type: "button",
8943
8805
  "aria-expanded": open,
@@ -8975,7 +8837,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
8975
8837
  const latestPreview = (0, _copilotkit_core.ɵgetToolCallPreview)(latest);
8976
8838
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8977
8839
  ...groupProps,
8978
- className: cn("cpk-tool-call-group cpk-tool-call-group-stack", className),
8840
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-group cpk-tool-call-group-stack", className),
8979
8841
  style: {
8980
8842
  paddingBottom: behind * 6,
8981
8843
  ...props.style
@@ -8985,7 +8847,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
8985
8847
  children: [
8986
8848
  Array.from({ length: behind }, (_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8987
8849
  "aria-hidden": "true",
8988
- className: cn(layer, "cpk-tool-call-group-stack-behind"),
8850
+ className: (0, _copilotkit_core.ɵcn)(layer, "cpk-tool-call-group-stack-behind"),
8989
8851
  style: {
8990
8852
  transform: `translateY(${(index + 1) * 6}px) scaleX(${1 - (index + 1) * .045})`,
8991
8853
  zIndex: -1 - index,
@@ -8997,7 +8859,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
8997
8859
  "aria-expanded": open,
8998
8860
  "aria-controls": open ? bodyId : void 0,
8999
8861
  onClick: () => setOpen((value) => !value),
9000
- className: cn("cpk-tool-call-group-stack-toggle", open ? "cpk-tool-call-group-stack-toggle-open" : [layer, "cpk-tool-call-group-stack-toggle-closed"]),
8862
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-group-stack-toggle", open ? "cpk-tool-call-group-stack-toggle-open" : [layer, "cpk-tool-call-group-stack-toggle-closed"]),
9001
8863
  children: open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
9002
8864
  (0, _copilotkit_core.ɵformatCountLabel)(calls.length, {
9003
8865
  one: labels.toolCallToolCallCountOne,
@@ -9016,7 +8878,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
9016
8878
  children: [
9017
8879
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusIcon, { status: latestStatus }),
9018
8880
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
9019
- className: cn("cpk-tool-call-group-stack-name", latestStatus === "running" && "cpk-shimmer"),
8881
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-group-stack-name", latestStatus === "running" && "cpk-shimmer"),
9020
8882
  children: latest.toolCall.function.name
9021
8883
  }),
9022
8884
  latestPreview && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -9062,7 +8924,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
9062
8924
  active: isActive
9063
8925
  },
9064
8926
  children: calls.map((call, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9065
- className: cn(layer, "cpk-tool-call-group-stack-item"),
8927
+ className: (0, _copilotkit_core.ɵcn)(layer, "cpk-tool-call-group-stack-item"),
9066
8928
  style: { animationDelay: `${index * 30}ms` },
9067
8929
  children: renderCall(call)
9068
8930
  }, call.toolCall.id))
@@ -9072,7 +8934,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
9072
8934
  }
9073
8935
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9074
8936
  ...groupProps,
9075
- className: cn("cpk-tool-call-group cpk-tool-call-group-card", className),
8937
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-group cpk-tool-call-group-card", className),
9076
8938
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
9077
8939
  type: "button",
9078
8940
  "aria-expanded": open,
@@ -9251,7 +9113,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
9251
9113
  className: "cpk-default-tool-call-title",
9252
9114
  children: [
9253
9115
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
9254
- className: cn("cpk-default-tool-call-chevron", isExpanded && "cpk-default-tool-call-chevron-open"),
9116
+ className: (0, _copilotkit_core.ɵcn)("cpk-default-tool-call-chevron", isExpanded && "cpk-default-tool-call-chevron-open"),
9255
9117
  fill: "none",
9256
9118
  viewBox: "0 0 24 24",
9257
9119
  strokeWidth: 2,
@@ -10866,160 +10728,53 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
10866
10728
 
10867
10729
  //#endregion
10868
10730
  //#region src/components/chat/CopilotChatInspectorButton.tsx
10869
- let shortcutsHidden = false;
10870
- const listeners$1 = /* @__PURE__ */ new Set();
10871
- const subscribe = (listener) => {
10872
- listeners$1.add(listener);
10873
- return () => {
10874
- listeners$1.delete(listener);
10875
- };
10876
- };
10877
- const getSnapshot = () => shortcutsHidden;
10878
- const getServerSnapshot = () => false;
10731
+ const subscribeToShortcuts = (listener) => _copilotkit_core.ɵinspectorShortcuts.subscribe(listener);
10732
+ const getShortcutsHidden = () => _copilotkit_core.ɵinspectorShortcuts.hidden;
10733
+ const getServerShortcutsHidden = () => false;
10734
+ /** Whether the user hid the Inspector shortcuts until the page reloads. */
10879
10735
  function useInspectorShortcutsHidden() {
10880
- return (0, react.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
10881
- }
10882
- function hideShortcuts() {
10883
- shortcutsHidden = true;
10884
- listeners$1.forEach((listener) => listener());
10736
+ return (0, react.useSyncExternalStore)(subscribeToShortcuts, getShortcutsHidden, getServerShortcutsHidden);
10885
10737
  }
10738
+ const hideShortcuts = () => _copilotkit_core.ɵinspectorShortcuts.hide();
10886
10739
  function InspectorKiteIcon({ className, ...props }) {
10887
10740
  const id = (0, react.useId)();
10888
10741
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
10889
10742
  ...props,
10890
10743
  "aria-hidden": "true",
10891
- className: cn("cpk-inspector-button-kite-icon", className),
10892
- viewBox: "4.57 3.36 17.8 17.8",
10744
+ className: (0, _copilotkit_core.ɵcn)("cpk-inspector-button-kite-icon", className),
10745
+ viewBox: _copilotkit_core.ɵinspectorKiteIcon.viewBox,
10893
10746
  fill: "none",
10894
- children: [
10895
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
10896
- d: "M6.36084 10.9855C8.34277 8.393 9.98843 5.82939 10.6204 3.75914C10.6382 3.70281 10.7043 3.67888 10.7534 3.7114C12.9536 5.16894 16.9635 6.12833 20.5086 6.15085C20.5703 6.15124 20.6124 6.2114 20.5895 6.26829C19.4109 9.25938 17.9705 14.6189 17.9148 20.7392C17.9148 20.8301 17.7873 20.8627 17.7419 20.7837C15.7236 17.2522 9.26021 12.2898 6.39414 11.1186C6.34112 11.0968 6.32556 11.0313 6.36084 10.9855Z",
10897
- fill: `url(#${id}-paint0_linear)`
10898
- }),
10899
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
10900
- d: "M13.0475 9.39974C9.95016 10.3806 7.11935 10.9259 6.44331 11.0498C6.40027 11.0577 6.39115 11.1172 6.43152 11.134C9.3203 12.3347 15.7516 17.2826 17.7511 20.7998C17.7551 20.8075 17.7647 20.8103 17.7728 20.8068C17.7809 20.803 17.7853 20.793 17.7819 20.7844L13.0475 9.39974Z",
10901
- fill: `url(#${id}-paint1_linear)`
10902
- }),
10903
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
10904
- d: "M10.762 3.705C13.4137 5.15161 16.4787 5.80132 20.545 6.14367C20.5703 6.14585 20.5787 6.18008 20.5557 6.19197C20.0359 6.45923 17.0574 7.97512 14.8455 8.78701C14.2524 9.00453 13.6564 9.20632 13.0692 9.39249C13.0562 9.39656 13.0419 9.39015 13.0369 9.37774L10.7005 3.75979C10.6849 3.72196 10.7257 3.68538 10.762 3.705Z",
10905
- fill: `url(#${id}-paint2_linear)`
10906
- }),
10907
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
10908
- d: "M10.7145 3.79041L17.8305 20.7659",
10909
- stroke: "#513C9F",
10910
- strokeWidth: "0.17284",
10911
- strokeLinecap: "round"
10912
- }),
10913
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
10914
- d: "M6.44531 11.0476C6.44531 11.0476 10.375 10.3422 14.0686 9.06804C17.7623 7.7939 20.5122 6.23373 20.5122 6.23373",
10915
- stroke: "#513C9F",
10916
- strokeWidth: "0.17284",
10917
- strokeLinecap: "round"
10918
- }),
10919
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
10920
- d: "M11.6914 5.93518L9.05534 14.7068M9.05534 14.7068H15.3203M9.05534 14.7068L0.15625 26.3646",
10921
- stroke: "#ABABAB",
10922
- strokeWidth: "0.302474",
10923
- strokeLinecap: "round"
10924
- }),
10925
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
10926
- d: "M6.02539 23.9646L4.85806 24.1287C5.46272 25.7287 6.70381 26.4276 8.18528 26.4276C11.8147 26.4276 10.707 22.3227 12.8103 22.3227C14.3358 22.3227 13.7155 25.6498 16.9992 25.6498C19.0029 25.6498 19.2028 23.631 18.8607 22.7625C18.8589 22.7572 18.8568 22.7524 18.8538 22.7476L18.3166 21.9253C18.2817 21.8706 18.1968 21.8912 18.1907 21.9562L18.0908 22.9529C18.0838 23.0222 18.0857 23.0913 18.0936 23.1605C18.1764 23.8491 18.2291 25.5202 16.9992 25.5202C15.7015 25.5202 15.3895 22.2362 12.8103 22.2362C9.78393 22.2362 10.1726 26.298 8.31487 26.298C7.08938 26.298 6.15447 24.9153 6.02539 23.9646Z",
10927
- fill: `url(#${id}-paint3_linear)`
10928
- }),
10929
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("defs", { children: [
10930
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
10931
- id: `${id}-paint0_linear`,
10932
- x1: "15.5372",
10933
- y1: "5.0278",
10934
- x2: "12.0802",
10935
- y2: "14.534",
10936
- gradientUnits: "userSpaceOnUse",
10937
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { stopColor: "#6430AB" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
10938
- offset: "1",
10939
- stopColor: "#AA89D8"
10940
- })]
10941
- }),
10942
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
10943
- id: `${id}-paint1_linear`,
10944
- x1: "12.8583",
10945
- y1: "10.3858",
10946
- x2: "8.40764",
10947
- y2: "18.9846",
10948
- gradientUnits: "userSpaceOnUse",
10949
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { stopColor: "#005DBB" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
10950
- offset: "1",
10951
- stopColor: "#3D92E8"
10952
- })]
10953
- }),
10954
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
10955
- id: `${id}-paint2_linear`,
10956
- x1: "14.8452",
10957
- y1: "5.02774",
10958
- x2: "13.5047",
10959
- y2: "9.21911",
10960
- gradientUnits: "userSpaceOnUse",
10961
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { stopColor: "#1B70C4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
10962
- offset: "1",
10963
- stopColor: "#54A4F2"
10964
- })]
10965
- }),
10966
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
10967
- id: `${id}-paint3_linear`,
10968
- x1: "4.85806",
10969
- y1: "24.2455",
10970
- x2: "18.9963",
10971
- y2: "24.2455",
10972
- gradientUnits: "userSpaceOnUse",
10973
- children: [
10974
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { stopColor: "#4497EA" }),
10975
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
10976
- offset: "0.254755",
10977
- stopColor: "#1463B2"
10978
- }),
10979
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
10980
- offset: "0.498725",
10981
- stopColor: "#0A437D"
10982
- }),
10983
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
10984
- offset: "0.666667",
10985
- stopColor: "#2476C8"
10986
- }),
10987
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
10988
- offset: "0.972542",
10989
- stopColor: "#0C549A"
10990
- })
10991
- ]
10992
- })
10993
- ] })
10994
- ]
10747
+ children: [_copilotkit_core.ɵinspectorKiteIcon.paths.map((path) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
10748
+ d: path.d,
10749
+ fill: (0, _copilotkit_core.ɵinspectorKiteFill)(id, path),
10750
+ stroke: path.stroke,
10751
+ strokeWidth: path.strokeWidth,
10752
+ strokeLinecap: path.strokeLinecap
10753
+ }, path.d)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("defs", { children: _copilotkit_core.ɵinspectorKiteIcon.gradients.map((gradient) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("linearGradient", {
10754
+ id: `${id}-${gradient.id}`,
10755
+ x1: gradient.x1,
10756
+ y1: gradient.y1,
10757
+ x2: gradient.x2,
10758
+ y2: gradient.y2,
10759
+ gradientUnits: "userSpaceOnUse",
10760
+ children: gradient.stops.map((stop) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
10761
+ offset: stop.offset,
10762
+ stopColor: stop.color
10763
+ }, `${stop.offset ?? "0"}-${stop.color}`))
10764
+ }, gradient.id)) })]
10995
10765
  });
10996
10766
  }
10997
10767
  function CopilotChatInspectorButton({ title, className, onClick, onPointerDown, onPointerEnter, onPointerLeave, onKeyDown, disabled, ...props }) {
10998
10768
  const labels = useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
10999
10769
  const { isInspectorEnabled } = useCopilotKitInspector();
11000
10770
  const hidden = useInspectorShortcutsHidden();
11001
- const [open, setOpen] = (0, react.useState)(false);
11002
- const [dark, setDark] = (0, react.useState)(false);
10771
+ const [menu] = (0, react.useState)(() => new _copilotkit_core.ɵHoverMenuController());
10772
+ const { open, dark } = (0, react.useSyncExternalStore)(menu.subscribe, menu.getSnapshot, menu.getSnapshot);
11003
10773
  const trigger = (0, react.useRef)(null);
11004
- const closeTimer = (0, react.useRef)(null);
11005
- const openedByHover = (0, react.useRef)(false);
11006
10774
  const primaryLabel = title || labels.assistantMessageToolbarInspectorLabel;
11007
- const cancelClose = () => {
11008
- if (closeTimer.current !== null) clearTimeout(closeTimer.current);
11009
- closeTimer.current = null;
11010
- };
11011
- (0, react.useEffect)(() => cancelClose, []);
11012
- const changeOpen = (next) => {
11013
- cancelClose();
11014
- if (next) setDark(!!trigger.current?.closest(".dark"));
11015
- setOpen(next);
11016
- };
11017
- const scheduleClose = () => {
11018
- cancelClose();
11019
- closeTimer.current = setTimeout(() => {
11020
- if (openedByHover.current) setOpen(false);
11021
- }, 180);
11022
- };
10775
+ (0, react.useEffect)(() => menu.dispose, [menu]);
10776
+ const { cancelClose, scheduleClose } = menu;
10777
+ const changeOpen = (next) => menu.setOpen(next, trigger.current);
11023
10778
  if (!isInspectorEnabled || hidden) return null;
11024
10779
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownMenu, {
11025
10780
  open,
@@ -11036,13 +10791,14 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
11036
10791
  size: "icon",
11037
10792
  "data-testid": "copilot-inspector-button",
11038
10793
  "aria-label": `${labels.assistantMessageToolbarInspectorTitle} (${labels.assistantMessageToolbarInspectorLocalOnlyLabel.toLowerCase()})`,
11039
- className: cn("cpk-inspector-button", className),
10794
+ className: (0, _copilotkit_core.ɵcn)("cpk-inspector-button", className),
11040
10795
  onPointerEnter: (event) => {
11041
10796
  onPointerEnter?.(event);
11042
- if (!disabled && event.pointerType !== "touch") {
11043
- openedByHover.current = true;
11044
- changeOpen(true);
11045
- }
10797
+ menu.pointerEnter({
10798
+ pointerType: event.pointerType,
10799
+ disabled,
10800
+ trigger: trigger.current
10801
+ });
11046
10802
  },
11047
10803
  onPointerLeave: (event) => {
11048
10804
  onPointerLeave?.(event);
@@ -11057,7 +10813,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
11057
10813
  onClick?.(event);
11058
10814
  },
11059
10815
  onKeyDown: (event) => {
11060
- openedByHover.current = false;
10816
+ menu.keyboardUsed();
11061
10817
  onKeyDown?.(event);
11062
10818
  if (!event.defaultPrevented && (event.key === "Enter" || event.key === " ")) {
11063
10819
  event.preventDefault();
@@ -11075,17 +10831,15 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
11075
10831
  align: "start",
11076
10832
  side: "top",
11077
10833
  sideOffset: 6,
11078
- className: cn("cpk-inspector-button-menu", dark && "dark"),
10834
+ className: (0, _copilotkit_core.ɵcn)("cpk-inspector-button-menu", dark && "dark"),
11079
10835
  onPointerEnter: cancelClose,
11080
10836
  onPointerLeave: scheduleClose,
11081
- onKeyDown: () => {
11082
- openedByHover.current = false;
11083
- },
10837
+ onKeyDown: menu.keyboardUsed,
11084
10838
  onOpenAutoFocus: (event) => {
11085
- if (openedByHover.current) event.preventDefault();
10839
+ if (menu.openedByHover) event.preventDefault();
11086
10840
  },
11087
10841
  onCloseAutoFocus: (event) => {
11088
- if (openedByHover.current) event.preventDefault();
10842
+ if (menu.openedByHover) event.preventDefault();
11089
10843
  },
11090
10844
  onFocusOutside: () => changeOpen(false),
11091
10845
  children: [
@@ -11106,7 +10860,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
11106
10860
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipContent, {
11107
10861
  side: "top",
11108
10862
  sideOffset: 6,
11109
- className: cn("cpk-inspector-button-local-tooltip", dark && "dark"),
10863
+ className: (0, _copilotkit_core.ɵcn)("cpk-inspector-button-local-tooltip", dark && "dark"),
11110
10864
  onPointerEnter: cancelClose,
11111
10865
  onPointerLeave: scheduleClose,
11112
10866
  children: labels.assistantMessageToolbarInspectorLocalOnlyDescription
@@ -11321,87 +11075,11 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
11321
11075
  "data-slot": "popover-content",
11322
11076
  align,
11323
11077
  sideOffset,
11324
- className: cn("cpk-popover", className),
11078
+ className: (0, _copilotkit_core.ɵcn)("cpk-popover", className),
11325
11079
  ...props
11326
11080
  }) }));
11327
11081
  PopoverContent.displayName = "PopoverContent";
11328
11082
 
11329
- //#endregion
11330
- //#region src/lib/message-feedback.ts
11331
- /** Trajectory event name for a rating of one assistant message. */
11332
- const MESSAGE_FEEDBACK_EVENT_NAME = "message.feedback";
11333
- /** Longest comment kept, in characters; the rest is cut so the event stays small. */
11334
- const MESSAGE_FEEDBACK_MAX_COMMENT_LENGTH = 1e3;
11335
- /** Longest excerpt of the rated response sent with the rating, in characters. */
11336
- const RESPONSE_EXCERPT_LENGTH = 500;
11337
- const ratings = /* @__PURE__ */ new Map();
11338
- const listeners = /* @__PURE__ */ new Map();
11339
- const threadKey = (agentId, threadId) => JSON.stringify([agentId, threadId]);
11340
- const messageKey = (agentId, threadId, messageId) => JSON.stringify([
11341
- agentId,
11342
- threadId,
11343
- messageId
11344
- ]);
11345
- /** Cuts `text` to `max` characters without splitting a surrogate pair. */
11346
- const clip = (text, max) => {
11347
- const characters = Array.from(text);
11348
- return characters.length > max ? characters.slice(0, max).join("") : text;
11349
- };
11350
- /** The comment as kept and sent: trimmed and capped, or none. */
11351
- const normalizeComment = (comment) => {
11352
- if (typeof comment !== "string") return void 0;
11353
- const text = clip(comment.trim(), MESSAGE_FEEDBACK_MAX_COMMENT_LENGTH);
11354
- return text === "" ? void 0 : text;
11355
- };
11356
- /** The rating this page gave one message, if any. */
11357
- function getMessageFeedback(agentId, threadId, messageId) {
11358
- return ratings.get(messageKey(agentId, threadId, messageId));
11359
- }
11360
- /** Calls `listener` whenever a rating in this Thread changes. */
11361
- function subscribeToMessageFeedback(agentId, threadId, listener) {
11362
- const key = threadKey(agentId, threadId);
11363
- let set = listeners.get(key);
11364
- if (set === void 0) {
11365
- set = /* @__PURE__ */ new Set();
11366
- listeners.set(key, set);
11367
- }
11368
- set.add(listener);
11369
- return () => {
11370
- set.delete(listener);
11371
- if (set.size === 0) listeners.delete(key);
11372
- };
11373
- }
11374
- /**
11375
- * Sets (or, with `null`, clears) this page's rating of one message and sends
11376
- * it to the active Trajectory. Every change is a new event; the newest event
11377
- * for a `feedbackId` is the current one. Like any Trajectory event, a change
11378
- * made while no Trajectory captures, for example during a reconnect, is not
11379
- * sent; the page still shows it.
11380
- */
11381
- function setMessageFeedback(params) {
11382
- const { copilotkit, agentId, threadId, message } = params;
11383
- const comment = normalizeComment(params.feedback?.comment);
11384
- const feedback = params.feedback && {
11385
- rating: params.feedback.rating,
11386
- ...comment ? { comment } : {}
11387
- };
11388
- const key = messageKey(agentId, threadId, message.id);
11389
- if (feedback) ratings.set(key, feedback);
11390
- else ratings.delete(key);
11391
- for (const listener of listeners.get(threadKey(agentId, threadId)) ?? []) listener();
11392
- const runId = copilotkit.getRunIdForMessage(agentId, threadId, message.id);
11393
- copilotkit.emitTrajectoryEvent(MESSAGE_FEEDBACK_EVENT_NAME, {
11394
- feedbackId: `${threadId}:${message.id}`,
11395
- threadId,
11396
- messageId: message.id,
11397
- agentId,
11398
- ...runId ? { runId } : {},
11399
- rating: feedback?.rating ?? null,
11400
- ...feedback?.comment ? { comment: feedback.comment } : {},
11401
- ...copilotkit.ɵlearningCapturesAgentText ? { response: clip(message.content ?? "", RESPONSE_EXCERPT_LENGTH) } : {}
11402
- });
11403
- }
11404
-
11405
11083
  //#endregion
11406
11084
  //#region src/components/chat/message-feedback.tsx
11407
11085
  /**
@@ -11410,180 +11088,61 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
11410
11088
  * or thumb slots.
11411
11089
  */
11412
11090
  const MessageFeedbackScopeContext = (0, react.createContext)(null);
11413
- const capturedCores = /* @__PURE__ */ new WeakSet();
11414
- const rememberCapture = (copilotkit) => {
11415
- if (capturedCores.has(copilotkit)) return;
11416
- capturedCores.add(copilotkit);
11417
- const unsubscribe = copilotkit.ɵsubscribeToLearningConfigured(() => {
11418
- if (copilotkit.ɵlearningConfigured) return;
11419
- capturedCores.delete(copilotkit);
11420
- unsubscribe();
11421
- });
11422
- };
11423
11091
  /**
11424
- * Whether the thumbs record feedback for Learning. True once a Trajectory of
11425
- * this Core has started and as long as Learning stays configured, also while
11426
- * capture reconnects or is stopped, so the buttons do not flicker. Ratings
11427
- * given meanwhile still show but, like any Trajectory event, are not
11428
- * sent. A capture that never starts (for example without a license) leaves it
11429
- * false.
11092
+ * Whether the thumbs record feedback for Learning. See core's
11093
+ * `ɵisLearningFeedbackEnabled` for the rules.
11430
11094
  */
11431
11095
  function useLearningFeedbackEnabled(copilotkit) {
11432
- const configured = (0, react.useSyncExternalStore)((0, react.useCallback)((onChange) => copilotkit.ɵsubscribeToLearningConfigured(onChange), [copilotkit]), () => copilotkit.ɵlearningConfigured, () => false);
11433
- const capturing = (0, react.useSyncExternalStore)((0, react.useCallback)((onChange) => copilotkit.subscribe({ onTrajectoryChanged: onChange }).unsubscribe, [copilotkit]), () => copilotkit.trajectoryId !== null, () => false);
11434
- (0, react.useEffect)(() => {
11435
- if (capturing) rememberCapture(copilotkit);
11436
- }, [capturing, copilotkit]);
11437
- return configured && (capturing || capturedCores.has(copilotkit));
11096
+ return (0, react.useSyncExternalStore)((0, react.useCallback)((onChange) => (0, _copilotkit_core.ɵsubscribeToLearningFeedbackEnabled)(copilotkit, onChange), [copilotkit]), () => (0, _copilotkit_core.ɵisLearningFeedbackEnabled)(copilotkit), () => false);
11438
11097
  }
11439
11098
  const noSubscription = () => () => {};
11440
11099
  /** Feedback controls for `message`, or `null` when this chat collects none. */
11441
11100
  function useMessageFeedback(message) {
11442
11101
  const scope = (0, react.useContext)(MessageFeedbackScopeContext);
11443
- const subscribe = (0, react.useCallback)((onChange) => scope ? subscribeToMessageFeedback(scope.agentId, scope.threadId, onChange) : noSubscription(), [scope]);
11444
- const getSnapshot = () => scope ? getMessageFeedback(scope.agentId, scope.threadId, message.id) : void 0;
11445
- const feedback = (0, react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
11446
- if (!scope) return null;
11447
- const save = (next) => setMessageFeedback({
11448
- ...scope,
11449
- message,
11450
- feedback: next
11451
- });
11452
- return {
11453
- feedback,
11454
- rate: (rating) => {
11455
- if (feedback?.rating !== rating) save({ rating });
11456
- },
11457
- clear: () => {
11458
- if (feedback) save(null);
11459
- },
11460
- comment: (comment) => {
11461
- if (feedback) save({
11462
- rating: feedback.rating,
11463
- comment
11464
- });
11465
- }
11466
- };
11102
+ const subscribe = (0, react.useCallback)((onChange) => scope ? (0, _copilotkit_core.ɵsubscribeToMessageFeedback)(scope.agentId, scope.threadId, onChange) : noSubscription(), [scope]);
11103
+ const getSnapshot = () => scope ? (0, _copilotkit_core.ɵgetMessageFeedback)(scope.agentId, scope.threadId, message.id) : void 0;
11104
+ (0, react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
11105
+ return scope ? (0, _copilotkit_core.ɵgetMessageFeedbackControls)(scope, message) : null;
11467
11106
  }
11468
11107
  /**
11469
- * How long the pointer may be away from the rating and its comment before the
11470
- * comment closes: enough to cross the gap between them, short enough that
11471
- * passing over a rating does not leave it open.
11472
- */
11473
- const FEEDBACK_COMMENT_CLOSE_DELAY_MS = 150;
11474
- /**
11475
- * Drives the comment popover of a rated message.
11476
- *
11477
- * It opens when a rating is given and whenever the pointer or keyboard focus
11478
- * reaches the chosen thumb, with the saved comment in the field. It closes by
11479
- * itself shortly after the pointer leaves the thumb and the popover, unless
11480
- * focus is in the field: then it stays until focus moves away, Enter, or
11481
- * Escape. Closing saves a changed comment; Escape, a click on a thumb, and
11482
- * removing the rating discard it.
11108
+ * Drives the comment popover of a rated message with core's
11109
+ * `ɵFeedbackCommentController`, which holds the open and close rules.
11483
11110
  */
11484
11111
  function useFeedbackComment(controls) {
11485
- const [open, setOpen] = (0, react.useState)(false);
11486
- const [draft, setDraft] = (0, react.useState)("");
11487
- const [focusRequest, setFocusRequest] = (0, react.useState)(0);
11112
+ const latestControls = (0, react.useRef)(controls);
11113
+ latestControls.current = controls;
11114
+ const [controller] = (0, react.useState)(() => new _copilotkit_core.ɵFeedbackCommentController({ getControls: () => latestControls.current }));
11488
11115
  const inputRef = (0, react.useRef)(null);
11489
- const timer = (0, react.useRef)(void 0);
11490
- const editing = (0, react.useRef)(false);
11491
- const focusWaiting = (0, react.useRef)(false);
11492
- const pointerOver = (0, react.useRef)(false);
11493
- const returning = (0, react.useRef)(false);
11494
- const latest = (0, react.useRef)({
11495
- controls,
11496
- draft,
11497
- open
11498
- });
11499
- latest.current = {
11500
- ...latest.current,
11501
- controls,
11502
- draft,
11503
- open
11504
- };
11505
- const takeFocusRequest = (0, react.useCallback)(() => {
11506
- const waiting = focusWaiting.current;
11507
- focusWaiting.current = false;
11508
- return waiting;
11509
- }, []);
11510
- const cancelClose = (0, react.useCallback)(() => {
11511
- if (timer.current === void 0) return;
11512
- clearTimeout(timer.current);
11513
- timer.current = void 0;
11514
- }, []);
11515
- (0, react.useEffect)(() => cancelClose, [cancelClose]);
11516
- const savedComment = (0, react.useCallback)(() => latest.current.controls?.feedback?.comment ?? "", []);
11517
- (0, react.useEffect)(() => () => {
11518
- const { open: wasOpen, controls: current, draft: text } = latest.current;
11519
- if (wasOpen && current?.feedback && text.trim() !== savedComment()) current.comment(text);
11520
- }, []);
11521
- const close = (0, react.useCallback)(({ save = true } = {}) => {
11522
- cancelClose();
11523
- focusWaiting.current = false;
11524
- pointerOver.current = false;
11525
- if (!latest.current.open) return;
11526
- const current = latest.current.controls;
11527
- if (save && current?.feedback && latest.current.draft.trim() !== savedComment()) current.comment(latest.current.draft);
11528
- editing.current = false;
11529
- latest.current = {
11530
- ...latest.current,
11531
- open: false
11532
- };
11533
- setOpen(false);
11534
- }, [cancelClose, savedComment]);
11535
- const show = ({ comment, focus }) => {
11536
- cancelClose();
11537
- latest.current = {
11538
- ...latest.current,
11539
- open: true,
11540
- draft: comment
11541
- };
11542
- setDraft(comment);
11543
- if (focus) {
11544
- focusWaiting.current = true;
11545
- setFocusRequest((request) => request + 1);
11546
- }
11547
- setOpen(true);
11548
- };
11116
+ const state = (0, react.useSyncExternalStore)(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
11117
+ (0, react.useEffect)(() => controller.dispose, [controller]);
11549
11118
  return {
11550
- open,
11551
- draft,
11552
- setDraft,
11553
- focusRequest,
11554
- takeFocusRequest,
11119
+ ...state,
11120
+ setDraft: controller.setDraft,
11121
+ takeFocusRequest: controller.takeFocusRequest,
11555
11122
  inputRef,
11556
- show,
11557
- enter: (via = "focus") => {
11558
- cancelClose();
11559
- if (via === "pointer") pointerOver.current = true;
11560
- if (returning.current) return;
11561
- if (!latest.current.open && latest.current.controls?.feedback) show({
11562
- comment: savedComment(),
11563
- focus: false
11564
- });
11565
- },
11566
- leave: (via = "focus") => {
11567
- if (via === "pointer") pointerOver.current = false;
11568
- else if (pointerOver.current) return;
11569
- cancelClose();
11570
- timer.current = setTimeout(() => {
11571
- timer.current = void 0;
11572
- if (!editing.current) close();
11573
- }, FEEDBACK_COMMENT_CLOSE_DELAY_MS);
11574
- },
11575
- setEditing: (value) => {
11576
- editing.current = value;
11577
- },
11578
- close,
11579
- returnFocus: (target) => {
11580
- returning.current = true;
11581
- try {
11582
- target?.focus();
11583
- } finally {
11584
- returning.current = false;
11585
- }
11586
- }
11123
+ show: controller.show,
11124
+ enter: controller.enter,
11125
+ leave: controller.leave,
11126
+ setEditing: controller.setEditing,
11127
+ close: controller.close,
11128
+ returnFocus: controller.returnFocus
11129
+ };
11130
+ }
11131
+
11132
+ //#endregion
11133
+ //#region src/components/chat/use-copy-feedback.ts
11134
+ /**
11135
+ * The "copied" check mark of a copy button, from core's `ɵCopyFeedback`: it
11136
+ * shows for two seconds after `markCopied()`, and a second copy restarts the
11137
+ * wait.
11138
+ */
11139
+ function useCopyFeedback() {
11140
+ const [feedback] = (0, react.useState)(() => new _copilotkit_core.ɵCopyFeedback());
11141
+ const copied = (0, react.useSyncExternalStore)(feedback.subscribe, feedback.getSnapshot, feedback.getSnapshot);
11142
+ (0, react.useEffect)(() => feedback.dispose, [feedback]);
11143
+ return {
11144
+ copied,
11145
+ markCopied: feedback.markCopied
11587
11146
  };
11588
11147
  }
11589
11148
 
@@ -11746,7 +11305,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
11746
11305
  function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible = true, markdownRenderer, toolbar, copyButton, inspectorButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, feedbackComment: feedbackCommentSlot, toolCallsView, children, className, ...props }) {
11747
11306
  const providerRenderer = useShallowStableRef(useMarkdownRenderer());
11748
11307
  const DefaultMarkdownRenderer = (0, react.useMemo)(() => resolveMarkdownRenderer(providerRenderer), [providerRenderer]);
11749
- const hasContent = !!(message.content && message.content.trim().length > 0);
11308
+ const hasContent = (0, _copilotkit_core.ɵhasAssistantMessageText)(message.content);
11750
11309
  const isLatestAssistantMessage = message.role === "assistant" && (isLatest ?? messages?.[messages.length - 1]?.id === message.id);
11751
11310
  const { isInspectorEnabled, openInspector } = useCopilotKitInspector();
11752
11311
  const shortcutsHidden = useInspectorShortcutsHidden();
@@ -11866,7 +11425,13 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
11866
11425
  message,
11867
11426
  messages
11868
11427
  });
11869
- const shouldShowToolbar = toolbarVisible && (hasContent || showInspectorShortcut) && !(isRunning && isLatestAssistantMessage);
11428
+ const shouldShowToolbar = (0, _copilotkit_core.ɵshouldShowAssistantToolbar)({
11429
+ toolbarVisible,
11430
+ hasContent,
11431
+ showInspectorShortcut,
11432
+ isRunning: !!isRunning,
11433
+ isLatest: isLatestAssistantMessage
11434
+ });
11870
11435
  const { open: commentOpen, close: closeComment } = comment;
11871
11436
  (0, react.useEffect)(() => {
11872
11437
  if (!commentOpen) return;
@@ -11916,7 +11481,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
11916
11481
  ref: root,
11917
11482
  "data-copilotkit": true,
11918
11483
  "data-testid": "copilot-assistant-message",
11919
- className: cn("copilotKitMessage copilotKitAssistantMessage", className),
11484
+ className: (0, _copilotkit_core.ɵcn)("copilotKitMessage copilotKitAssistantMessage", className),
11920
11485
  ...props,
11921
11486
  "data-message-id": message.id,
11922
11487
  children: [
@@ -11951,7 +11516,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
11951
11516
  };
11952
11517
  _CopilotChatAssistantMessage.Toolbar = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
11953
11518
  "data-testid": "copilot-assistant-toolbar",
11954
- className: cn("cpk-assistant-message-toolbar", className),
11519
+ className: (0, _copilotkit_core.ɵcn)("cpk-assistant-message-toolbar", className),
11955
11520
  ...props
11956
11521
  });
11957
11522
  const ToolbarButton = _CopilotChatAssistantMessage.ToolbarButton = ({ title, tooltip, tooltipClassName, children, ...props }) => {
@@ -11979,24 +11544,10 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
11979
11544
  };
11980
11545
  _CopilotChatAssistantMessage.CopyButton = ({ className, title, onClick, ...props }) => {
11981
11546
  const labels = useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
11982
- const [copied, setCopied] = (0, react.useState)(false);
11983
- const timerRef = (0, react.useRef)(null);
11984
- (0, react.useEffect)(() => {
11985
- return () => {
11986
- if (timerRef.current !== null) clearTimeout(timerRef.current);
11987
- };
11988
- }, []);
11547
+ const { copied, markCopied } = useCopyFeedback();
11989
11548
  const handleClick = async (event) => {
11990
- let success = false;
11991
- if (onClick) success = await Promise.resolve(onClick(event)) === true;
11992
- if (success) {
11993
- setCopied(true);
11994
- if (timerRef.current !== null) clearTimeout(timerRef.current);
11995
- timerRef.current = setTimeout(() => {
11996
- timerRef.current = null;
11997
- setCopied(false);
11998
- }, 2e3);
11999
- }
11549
+ if (!onClick) return;
11550
+ if (await Promise.resolve(onClick(event)) === true) markCopied();
12000
11551
  };
12001
11552
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
12002
11553
  "data-testid": "copilot-copy-button",
@@ -12047,7 +11598,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12047
11598
  const changed = value.trim() !== savedComment;
12048
11599
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
12049
11600
  "data-testid": "copilot-feedback-comment",
12050
- className: cn("cpk-assistant-message-feedback-comment", className),
11601
+ className: (0, _copilotkit_core.ɵcn)("cpk-assistant-message-feedback-comment", className),
12051
11602
  onSubmit: (event) => {
12052
11603
  event.preventDefault();
12053
11604
  onSubmit();
@@ -12063,7 +11614,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12063
11614
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
12064
11615
  ref: inputRef,
12065
11616
  value,
12066
- maxLength: MESSAGE_FEEDBACK_MAX_COMMENT_LENGTH,
11617
+ maxLength: _copilotkit_core.ɵMESSAGE_FEEDBACK_MAX_COMMENT_LENGTH,
12067
11618
  onChange: (event) => onChange(event.target.value),
12068
11619
  placeholder: labels.assistantMessageFeedbackCommentPlaceholder,
12069
11620
  "aria-label": labels.assistantMessageFeedbackCommentPlaceholder,
@@ -12206,14 +11757,14 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12206
11757
  const [error, setError] = (0, react.useState)(false);
12207
11758
  const { thumbnailRef, vtName, open, openLightbox, closeLightbox } = useLightbox();
12208
11759
  if (error) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
12209
- className: cn("cpk-attachment-renderer cpk-attachment-renderer-image-error", className),
11760
+ className: (0, _copilotkit_core.ɵcn)("cpk-attachment-renderer cpk-attachment-renderer-image-error", className),
12210
11761
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: labels.attachmentImageLoadErrorText })
12211
11762
  });
12212
11763
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
12213
11764
  ref: thumbnailRef,
12214
11765
  src,
12215
11766
  alt: labels.attachmentImageAltText,
12216
- className: cn("cpk-attachment-renderer cpk-attachment-renderer-image", className),
11767
+ className: (0, _copilotkit_core.ɵcn)("cpk-attachment-renderer cpk-attachment-renderer-image", className),
12217
11768
  onClick: openLightbox,
12218
11769
  onError: () => setError(true)
12219
11770
  }), open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Lightbox, {
@@ -12228,7 +11779,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12228
11779
  });
12229
11780
  const AudioAttachment = (0, react.memo)(function AudioAttachment({ src, filename, className }) {
12230
11781
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12231
- className: cn("cpk-attachment-renderer cpk-attachment-renderer-audio", className),
11782
+ className: (0, _copilotkit_core.ɵcn)("cpk-attachment-renderer cpk-attachment-renderer-audio", className),
12232
11783
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("audio", {
12233
11784
  src,
12234
11785
  controls: true,
@@ -12245,7 +11796,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12245
11796
  src,
12246
11797
  controls: true,
12247
11798
  preload: "metadata",
12248
- className: cn("cpk-attachment-renderer cpk-attachment-renderer-video", className)
11799
+ className: (0, _copilotkit_core.ɵcn)("cpk-attachment-renderer cpk-attachment-renderer-video", className)
12249
11800
  });
12250
11801
  });
12251
11802
  const DocumentAttachment = (0, react.memo)(function DocumentAttachment({ src, source, filename, className }) {
@@ -12257,7 +11808,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12257
11808
  target: "_blank",
12258
11809
  rel: "noopener noreferrer",
12259
11810
  "aria-label": label,
12260
- className: cn("cpk-attachment-renderer cpk-attachment-renderer-document", className),
11811
+ className: (0, _copilotkit_core.ɵcn)("cpk-attachment-renderer cpk-attachment-renderer-document", className),
12261
11812
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12262
11813
  className: "cpk-attachment-renderer-document-icon",
12263
11814
  children: (0, _copilotkit_shared.getDocumentIcon)(source.mimeType ?? "")
@@ -12294,25 +11845,9 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12294
11845
 
12295
11846
  //#endregion
12296
11847
  //#region src/components/chat/CopilotChatUserMessage.tsx
12297
- function flattenUserMessageContent(content) {
12298
- if (!content) return "";
12299
- if (typeof content === "string") return content;
12300
- return content.map((part) => {
12301
- if (part && typeof part === "object" && "type" in part && part.type === "text" && typeof part.text === "string") return part.text;
12302
- return "";
12303
- }).filter((text) => text.length > 0).join("\n");
12304
- }
12305
- function getMediaParts(content) {
12306
- if (!content || typeof content === "string") return [];
12307
- return content.filter((part) => part.type === "image" || part.type === "audio" || part.type === "video" || part.type === "document");
12308
- }
12309
- function getFilename(part) {
12310
- const meta = part.metadata;
12311
- if (meta != null && typeof meta === "object" && "filename" in meta && typeof meta.filename === "string") return meta.filename;
12312
- }
12313
11848
  function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfBranches, onSwitchToBranch, additionalToolbarItems, messageRenderer, toolbar, copyButton, editButton, branchNavigation, children, className, ...props }) {
12314
- const flattenedContent = (0, react.useMemo)(() => flattenUserMessageContent(message.content), [message.content]);
12315
- const mediaParts = (0, react.useMemo)(() => getMediaParts(message.content), [message.content]);
11849
+ const flattenedContent = (0, react.useMemo)(() => (0, _copilotkit_core.ɵflattenUserMessageContent)(message.content), [message.content]);
11850
+ const mediaParts = (0, react.useMemo)(() => (0, _copilotkit_core.ɵgetUserMessageMediaParts)(message.content), [message.content]);
12316
11851
  const BoundMessageRenderer = renderSlot(messageRenderer, CopilotChatUserMessage.MessageRenderer, { content: flattenedContent });
12317
11852
  const BoundCopyButton = renderSlot(copyButton, CopilotChatUserMessage.CopyButton, { onClick: async () => {
12318
11853
  if (flattenedContent) return await (0, _copilotkit_shared.copyToClipboard)(flattenedContent);
@@ -12325,7 +11860,11 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12325
11860
  onSwitchToBranch,
12326
11861
  message
12327
11862
  });
12328
- const showBranchNavigation = numberOfBranches && numberOfBranches > 1 && onSwitchToBranch;
11863
+ const { show: showBranchNavigation } = (0, _copilotkit_core.ɵgetBranchNavState)({
11864
+ branchIndex: branchIndex ?? 0,
11865
+ numberOfBranches: numberOfBranches ?? 1,
11866
+ canSwitch: onSwitchToBranch !== void 0
11867
+ });
12329
11868
  const BoundToolbar = renderSlot(toolbar, CopilotChatUserMessage.Toolbar, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12330
11869
  className: "cpk-user-message-toolbar-items",
12331
11870
  children: [
@@ -12353,7 +11892,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12353
11892
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12354
11893
  "data-copilotkit": true,
12355
11894
  "data-testid": "copilot-user-message",
12356
- className: cn("copilotKitMessage copilotKitUserMessage cpk-user-message", className),
11895
+ className: (0, _copilotkit_core.ɵcn)("copilotKitMessage copilotKitUserMessage cpk-user-message", className),
12357
11896
  "data-message-id": message.id,
12358
11897
  ...props,
12359
11898
  children: [
@@ -12362,7 +11901,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12362
11901
  children: mediaParts.map((part, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChatAttachmentRenderer, {
12363
11902
  type: part.type,
12364
11903
  source: part.source,
12365
- filename: getFilename(part)
11904
+ filename: (0, _copilotkit_core.ɵgetUserMessageMediaFilename)(part)
12366
11905
  }, index))
12367
11906
  }),
12368
11907
  BoundMessageRenderer,
@@ -12372,17 +11911,17 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12372
11911
  }
12373
11912
  (function(_CopilotChatUserMessage) {
12374
11913
  _CopilotChatUserMessage.Container = ({ children, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
12375
- className: cn("cpk-user-message-container", className),
11914
+ className: (0, _copilotkit_core.ɵcn)("cpk-user-message-container", className),
12376
11915
  ...props,
12377
11916
  children
12378
11917
  });
12379
11918
  _CopilotChatUserMessage.MessageRenderer = ({ content, className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
12380
- className: cn("cpk-user-message-bubble", className),
11919
+ className: (0, _copilotkit_core.ɵcn)("cpk-user-message-bubble", className),
12381
11920
  children: content
12382
11921
  });
12383
11922
  _CopilotChatUserMessage.Toolbar = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
12384
11923
  "data-testid": "copilot-user-toolbar",
12385
- className: cn("cpk-user-message-toolbar", className),
11924
+ className: (0, _copilotkit_core.ɵcn)("cpk-user-message-toolbar", className),
12386
11925
  ...props
12387
11926
  });
12388
11927
  const ToolbarButton = _CopilotChatUserMessage.ToolbarButton = ({ title, children, className, ...props }) => {
@@ -12403,14 +11942,10 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12403
11942
  };
12404
11943
  _CopilotChatUserMessage.CopyButton = ({ className, title, onClick, ...props }) => {
12405
11944
  const labels = useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
12406
- const [copied, setCopied] = (0, react.useState)(false);
11945
+ const { copied, markCopied } = useCopyFeedback();
12407
11946
  const handleClick = async (event) => {
12408
- let success = false;
12409
- if (onClick) success = await Promise.resolve(onClick(event)) === true;
12410
- if (success) {
12411
- setCopied(true);
12412
- setTimeout(() => setCopied(false), 2e3);
12413
- }
11947
+ if (!onClick) return;
11948
+ if (await Promise.resolve(onClick(event)) === true) markCopied();
12414
11949
  };
12415
11950
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
12416
11951
  "data-testid": "copilot-user-copy-button",
@@ -12444,12 +11979,15 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12444
11979
  };
12445
11980
  _CopilotChatUserMessage.BranchNavigation = ({ className, currentBranch = 0, numberOfBranches = 1, onSwitchToBranch, message, ...props }) => {
12446
11981
  const labels = useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
12447
- if (!numberOfBranches || numberOfBranches <= 1 || !onSwitchToBranch) return null;
12448
- const canGoPrev = currentBranch > 0;
12449
- const canGoNext = currentBranch < numberOfBranches - 1;
11982
+ const { show, canGoPrev, canGoNext } = (0, _copilotkit_core.ɵgetBranchNavState)({
11983
+ branchIndex: currentBranch,
11984
+ numberOfBranches,
11985
+ canSwitch: onSwitchToBranch !== void 0
11986
+ });
11987
+ if (!show) return null;
12450
11988
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12451
11989
  "data-testid": "copilot-branch-navigation",
12452
- className: cn("cpk-user-message-branch-navigation", className),
11990
+ className: (0, _copilotkit_core.ɵcn)("cpk-user-message-branch-navigation", className),
12453
11991
  ...props,
12454
11992
  children: [
12455
11993
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
@@ -12508,27 +12046,6 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12508
12046
  //#endregion
12509
12047
  //#region src/components/chat/CopilotChatReasoningMessage.tsx
12510
12048
  /**
12511
- * The reasoning time as label text, such as "4 seconds" or "1m 5s".
12512
- *
12513
- * @param seconds - The elapsed time in seconds. It may have a fraction.
12514
- * @param labels - The chat labels that hold the duration texts.
12515
- */
12516
- function formatDuration(seconds, labels) {
12517
- const duration = (0, _copilotkit_core.ɵformatReasoningDuration)(seconds);
12518
- switch (duration.unit) {
12519
- case "fewSeconds": return labels.reasoningMessageDurationFewSeconds;
12520
- case "seconds": return (0, _copilotkit_core.ɵformatLabel)(labels.reasoningMessageDurationSeconds, { count: duration.seconds });
12521
- case "minutes": return (0, _copilotkit_core.ɵformatCountLabel)(duration.minutes, {
12522
- one: labels.reasoningMessageDurationMinutesOne,
12523
- other: labels.reasoningMessageDurationMinutesOther
12524
- });
12525
- case "minutesSeconds": return (0, _copilotkit_core.ɵformatLabel)(labels.reasoningMessageDurationMinutesSeconds, {
12526
- minutes: duration.minutes,
12527
- seconds: duration.seconds
12528
- });
12529
- }
12530
- }
12531
- /**
12532
12049
  * A reasoning message as a collapsible block. While the model reasons it is
12533
12050
  * open and the header shows `labels.reasoningMessageThinkingLabel`; when
12534
12051
  * streaming ends it collapses and the header reads
@@ -12566,7 +12083,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12566
12083
  userToggledRef.current = true;
12567
12084
  setIsOpen((prev) => !prev);
12568
12085
  } : void 0;
12569
- const label = isStreaming ? labels.reasoningMessageThinkingLabel : (0, _copilotkit_core.ɵformatLabel)(labels.reasoningMessageThoughtForLabel, { duration: formatDuration(elapsed, labels) });
12086
+ const label = isStreaming ? labels.reasoningMessageThinkingLabel : (0, _copilotkit_core.ɵformatLabel)(labels.reasoningMessageThoughtForLabel, { duration: (0, _copilotkit_core.ɵformatReasoningDurationLabel)(elapsed, labels) });
12570
12087
  const boundHeader = renderSlot(header, CopilotChatReasoningMessage.Header, {
12571
12088
  isOpen,
12572
12089
  label,
@@ -12597,7 +12114,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12597
12114
  })
12598
12115
  });
12599
12116
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12600
- className: cn("cpk-reasoning-message", className),
12117
+ className: (0, _copilotkit_core.ɵcn)("cpk-reasoning-message", className),
12601
12118
  "data-message-id": message.id,
12602
12119
  ...props,
12603
12120
  children: [boundHeader, boundToggle]
@@ -12608,7 +12125,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12608
12125
  const isExpandable = !!hasContent;
12609
12126
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
12610
12127
  type: "button",
12611
- className: cn("cpk-reasoning-message-header", isExpandable && "cpk-reasoning-message-header-expandable", className),
12128
+ className: (0, _copilotkit_core.ɵcn)("cpk-reasoning-message-header", isExpandable && "cpk-reasoning-message-header-expandable", className),
12612
12129
  "aria-expanded": isExpandable ? isOpen : void 0,
12613
12130
  ...headerProps,
12614
12131
  children: [
@@ -12623,7 +12140,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12623
12140
  headerChildren,
12624
12141
  isExpandable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotIcon, {
12625
12142
  name: "ChevronRight",
12626
- className: cn("cpk-reasoning-message-chevron", isOpen && "cpk-reasoning-message-chevron-open")
12143
+ className: (0, _copilotkit_core.ɵcn)("cpk-reasoning-message-chevron", isOpen && "cpk-reasoning-message-chevron-open")
12627
12144
  })
12628
12145
  ]
12629
12146
  });
@@ -12631,7 +12148,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12631
12148
  _CopilotChatReasoningMessage.Content = ({ isStreaming, hasContent, className, children: contentChildren, ...contentProps }) => {
12632
12149
  if (!hasContent && !isStreaming) return null;
12633
12150
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
12634
- className: cn("cpk-reasoning-message-content", className),
12151
+ className: (0, _copilotkit_core.ɵcn)("cpk-reasoning-message-content", className),
12635
12152
  ...contentProps,
12636
12153
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12637
12154
  className: "cpk-reasoning-message-text",
@@ -12647,7 +12164,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12647
12164
  };
12648
12165
  _CopilotChatReasoningMessage.Toggle = ({ isOpen, className, children: toggleChildren, ...toggleProps }) => {
12649
12166
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
12650
- className: cn("cpk-reasoning-message-toggle", className),
12167
+ className: (0, _copilotkit_core.ɵcn)("cpk-reasoning-message-toggle", className),
12651
12168
  style: { gridTemplateRows: isOpen ? "1fr" : "0fr" },
12652
12169
  ...toggleProps,
12653
12170
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -12701,7 +12218,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12701
12218
  ref,
12702
12219
  "data-copilotkit": true,
12703
12220
  "data-testid": "copilot-suggestions",
12704
- className: cn("cpk-suggestion-view", className),
12221
+ className: (0, _copilotkit_core.ɵcn)("cpk-suggestion-view", className),
12705
12222
  ...props
12706
12223
  });
12707
12224
  });
@@ -12815,49 +12332,41 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12815
12332
  */
12816
12333
  function CopilotChatWorkSummary({ isWorking, isOpen, calls, elapsedMs, workingSince, className, ...props }) {
12817
12334
  const labels = useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
12818
- const now = useNow(isWorking);
12819
- const failed = (0, _copilotkit_core.ɵcountFailedToolCalls)(calls);
12820
- const toolCount = (0, _copilotkit_core.ɵformatCountLabel)(calls.length, {
12821
- one: labels.toolCallToolCountOne,
12822
- other: labels.toolCallToolCountOther
12335
+ const text = (0, _copilotkit_core.ɵgetWorkSummaryText)({
12336
+ isWorking,
12337
+ calls,
12338
+ elapsedMs,
12339
+ workingSince,
12340
+ now: useNow(isWorking),
12341
+ labels
12823
12342
  });
12824
- const liveMs = elapsedMs !== void 0 && workingSince !== void 0 ? elapsedMs + Math.max(0, now - workingSince) : void 0;
12825
- const duration = elapsedMs !== void 0 ? (0, _copilotkit_core.ɵformatWorkDuration)(Math.max(1e3, elapsedMs)) : void 0;
12826
12343
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
12827
12344
  type: "button",
12828
12345
  "data-copilotkit": true,
12829
12346
  "data-testid": "copilot-work-summary",
12830
12347
  "data-state": isWorking ? "working" : "done",
12831
12348
  "aria-expanded": isOpen,
12832
- className: cn("cpk-work-summary", className),
12349
+ className: (0, _copilotkit_core.ɵcn)("cpk-work-summary", className),
12833
12350
  ...props,
12834
- children: [isWorking ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12835
- className: "cpk-work-summary-label cpk-shimmer",
12836
- children: labels.workSummaryWorkingLabel
12837
- }), liveMs !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12838
- className: "cpk-work-summary-detail cpk-work-summary-timer",
12839
- children: (0, _copilotkit_core.ɵformatWorkDuration)(liveMs)
12840
- })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
12351
+ children: [
12841
12352
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12842
- className: "cpk-work-summary-label",
12843
- children: duration ? (0, _copilotkit_core.ɵformatLabel)(labels.workSummaryWorkedForLabel, { duration }) : (0, _copilotkit_core.ɵformatCountLabel)(calls.length, {
12844
- one: labels.toolCallUsedToolsOne,
12845
- other: labels.toolCallUsedToolsOther
12846
- })
12353
+ className: (0, _copilotkit_core.ɵcn)("cpk-work-summary-label", isWorking && "cpk-shimmer"),
12354
+ children: text.label
12847
12355
  }),
12848
- duration && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12849
- className: "cpk-work-summary-detail",
12850
- children: toolCount
12356
+ text.detail !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12357
+ className: (0, _copilotkit_core.ɵcn)("cpk-work-summary-detail", isWorking && "cpk-work-summary-timer"),
12358
+ children: text.detail
12851
12359
  }),
12852
- failed > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12360
+ text.failed !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12853
12361
  className: "cpk-work-summary-failed",
12854
- children: (0, _copilotkit_core.ɵformatLabel)(labels.toolCallFailedCountLabel, { count: failed })
12362
+ children: text.failed
12363
+ }),
12364
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotIcon, {
12365
+ name: "ChevronRight",
12366
+ "aria-hidden": "true",
12367
+ className: (0, _copilotkit_core.ɵcn)("cpk-work-summary-chevron", isOpen && "cpk-work-summary-chevron-open")
12855
12368
  })
12856
- ] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotIcon, {
12857
- name: "ChevronRight",
12858
- "aria-hidden": "true",
12859
- className: cn("cpk-work-summary-chevron", isOpen && "cpk-work-summary-chevron-open")
12860
- })]
12369
+ ]
12861
12370
  });
12862
12371
  }
12863
12372
 
@@ -12898,7 +12407,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
12898
12407
  */
12899
12408
  function IntelligenceIndicatorView({ message, status, label, className, ...rest }) {
12900
12409
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
12901
- className: cn("cpk-intelligence-indicator", className),
12410
+ className: (0, _copilotkit_core.ɵcn)("cpk-intelligence-indicator", className),
12902
12411
  role: "status",
12903
12412
  "aria-live": "polite",
12904
12413
  "data-testid": `cpk-intelligence-indicator-${message.id}`,
@@ -13864,7 +13373,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
13864
13373
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
13865
13374
  "data-copilotkit": true,
13866
13375
  "data-testid": "copilot-message-list",
13867
- className: cn("copilotKitMessages cpk-message-view", className),
13376
+ className: (0, _copilotkit_core.ɵcn)("copilotKitMessages cpk-message-view", className),
13868
13377
  ...props,
13869
13378
  children: [
13870
13379
  shouldVirtualize ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -13904,7 +13413,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
13904
13413
  CopilotChatMessageView.Cursor = function Cursor({ className, ...props }) {
13905
13414
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
13906
13415
  "data-testid": "copilot-loading-cursor",
13907
- className: cn("cpk-message-view-cursor", className),
13416
+ className: (0, _copilotkit_core.ɵcn)("cpk-message-view-cursor", className),
13908
13417
  ...props
13909
13418
  });
13910
13419
  };
@@ -13920,10 +13429,10 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
13920
13429
  if (attachments.length === 0) return null;
13921
13430
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
13922
13431
  "data-testid": "copilot-attachment-queue",
13923
- className: cn("cpk-attachment-queue", className),
13432
+ className: (0, _copilotkit_core.ɵcn)("cpk-attachment-queue", className),
13924
13433
  children: attachments.map((attachment) => {
13925
13434
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
13926
- className: cn("cpk-attachment-queue-item", attachment.type === "image" || attachment.type === "video" ? "cpk-attachment-queue-item-media" : attachment.type === "audio" ? "cpk-attachment-queue-item-audio" : "cpk-attachment-queue-item-document"),
13435
+ className: (0, _copilotkit_core.ɵcn)("cpk-attachment-queue-item", attachment.type === "image" || attachment.type === "video" ? "cpk-attachment-queue-item-media" : attachment.type === "audio" ? "cpk-attachment-queue-item-audio" : "cpk-attachment-queue-item-document"),
13927
13436
  children: [
13928
13437
  attachment.status === "uploading" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UploadingOverlay, {}),
13929
13438
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AttachmentPreview, { attachment }),
@@ -14140,7 +13649,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
14140
13649
  const previewable = canPreviewInBrowser(mimeType);
14141
13650
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14142
13651
  ref: thumbnailRef,
14143
- className: cn("cpk-attachment-queue-document", previewable && "cpk-attachment-queue-document-previewable"),
13652
+ className: (0, _copilotkit_core.ɵcn)("cpk-attachment-queue-document", previewable && "cpk-attachment-queue-document-previewable"),
14144
13653
  onClick: previewable ? openLightbox : void 0,
14145
13654
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
14146
13655
  className: "cpk-attachment-queue-document-icon",
@@ -14173,53 +13682,11 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
14173
13682
  * @returns KeyboardState object with keyboard information
14174
13683
  */
14175
13684
  function useKeyboardHeight() {
14176
- const [keyboardState, setKeyboardState] = (0, react.useState)({
14177
- isKeyboardOpen: false,
14178
- keyboardHeight: 0,
14179
- availableHeight: typeof window !== "undefined" ? window.innerHeight : 0,
14180
- viewportHeight: typeof window !== "undefined" ? window.innerHeight : 0
14181
- });
14182
- (0, react.useEffect)(() => {
14183
- if (typeof window === "undefined") return;
14184
- const visualViewport = window.visualViewport;
14185
- if (!visualViewport) return;
14186
- const updateKeyboardState = () => {
14187
- const layoutHeight = window.innerHeight;
14188
- const visualHeight = visualViewport.height;
14189
- const keyboardHeight = Math.max(0, layoutHeight - visualHeight);
14190
- setKeyboardState({
14191
- isKeyboardOpen: keyboardHeight > 150,
14192
- keyboardHeight,
14193
- availableHeight: visualHeight,
14194
- viewportHeight: layoutHeight
14195
- });
14196
- };
14197
- updateKeyboardState();
14198
- visualViewport.addEventListener("resize", updateKeyboardState);
14199
- visualViewport.addEventListener("scroll", updateKeyboardState);
14200
- return () => {
14201
- visualViewport.removeEventListener("resize", updateKeyboardState);
14202
- visualViewport.removeEventListener("scroll", updateKeyboardState);
14203
- };
14204
- }, []);
13685
+ const [keyboardState, setKeyboardState] = (0, react.useState)(_copilotkit_core.ɵinitialKeyboardState);
13686
+ (0, react.useEffect)(() => (0, _copilotkit_core.ɵwatchKeyboardState)(setKeyboardState), []);
14205
13687
  return keyboardState;
14206
13688
  }
14207
13689
 
14208
- //#endregion
14209
- //#region src/components/chat/normalize-auto-scroll.ts
14210
- const VALID = [
14211
- "pin-to-bottom",
14212
- "pin-to-send",
14213
- "none"
14214
- ];
14215
- function normalizeAutoScroll(value) {
14216
- if (value === void 0) return "pin-to-bottom";
14217
- if (value === true) return "pin-to-bottom";
14218
- if (value === false) return "none";
14219
- if (VALID.includes(value)) return value;
14220
- return "pin-to-bottom";
14221
- }
14222
-
14223
13690
  //#endregion
14224
13691
  //#region src/components/chat/last-user-message-context.ts
14225
13692
  const LastUserMessageContext = react.default.createContext({
@@ -14229,6 +13696,11 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
14229
13696
 
14230
13697
  //#endregion
14231
13698
  //#region src/hooks/use-pin-to-send.ts
13699
+ /**
13700
+ * Pins the latest sent user message near the top of the chat while the reply
13701
+ * streams below it. Core's `ɵpinMessageToTop` does the measuring and
13702
+ * scrolling; this hook runs it once per send.
13703
+ */
14232
13704
  function usePinToSend({ scrollRef, contentRef, spacerRef, topOffset = 16 }) {
14233
13705
  const { id, sendNonce } = (0, react.useContext)(LastUserMessageContext);
14234
13706
  const lastNonceRef = (0, react.useRef)(-1);
@@ -14241,35 +13713,15 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
14241
13713
  const contentEl = contentRef.current;
14242
13714
  const spacerEl = spacerRef.current;
14243
13715
  if (!scrollEl || !contentEl || !spacerEl) return;
14244
- const escaped = typeof CSS !== "undefined" && CSS.escape ? CSS.escape(id) : id.replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "\\$&");
14245
- const targetEl = contentEl.querySelector(`[data-message-id="${escaped}"]`);
14246
- if (!targetEl) return;
14247
- const viewportHeight = scrollEl.clientHeight;
14248
- const userMessageHeight = targetEl.getBoundingClientRect().height;
14249
- const paddingTop = parseFloat(getComputedStyle(targetEl).paddingTop) || 0;
14250
- const bubbleHeight = Math.max(0, userMessageHeight - paddingTop);
14251
- const spacerHeight = Math.max(0, viewportHeight - bubbleHeight - topOffset);
14252
- spacerEl.style.height = `${spacerHeight}px`;
14253
- let pinned = false;
14254
- const raf = requestAnimationFrame(() => {
14255
- pinned = true;
14256
- const targetTop = computeOffsetTop(targetEl, scrollEl) + paddingTop - topOffset;
14257
- scrollEl.scrollTo({
14258
- top: Math.max(0, targetTop),
14259
- behavior: "smooth"
14260
- });
14261
- });
14262
- const ro = new ResizeObserver(() => {
14263
- if (!contentEl || !spacerEl || !scrollEl) return;
14264
- const consumedBelow = contentEl.getBoundingClientRect().height - computeOffsetTop(targetEl, contentEl) - userMessageHeight;
14265
- const remaining = Math.max(0, spacerHeight - consumedBelow);
14266
- spacerEl.style.height = `${remaining}px`;
13716
+ const unpin = (0, _copilotkit_core.ɵpinMessageToTop)({
13717
+ scrollEl,
13718
+ contentEl,
13719
+ spacerEl,
13720
+ messageId: id,
13721
+ topOffset
14267
13722
  });
14268
- ro.observe(contentEl);
14269
13723
  return () => {
14270
- cancelAnimationFrame(raf);
14271
- ro.disconnect();
14272
- if (!pinned) lastNonceRef.current = previousNonce;
13724
+ if (!unpin()) lastNonceRef.current = previousNonce;
14273
13725
  };
14274
13726
  }, [
14275
13727
  id,
@@ -14280,11 +13732,6 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
14280
13732
  topOffset
14281
13733
  ]);
14282
13734
  }
14283
- function computeOffsetTop(el, stopAt) {
14284
- const elRect = el.getBoundingClientRect();
14285
- const stopRect = stopAt.getBoundingClientRect();
14286
- return elRect.top - stopRect.top + stopAt.scrollTop;
14287
- }
14288
13735
 
14289
13736
  //#endregion
14290
13737
  //#region src/components/chat/CopilotChatView.tsx
@@ -14439,7 +13886,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
14439
13886
  onDragOver,
14440
13887
  onDragLeave,
14441
13888
  onDrop,
14442
- className: cn("copilotKitChat cpk-chat-view", className),
13889
+ className: (0, _copilotkit_core.ɵcn)("copilotKitChat cpk-chat-view", className),
14443
13890
  ...props,
14444
13891
  children: [dragOver && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropOverlay, {}), BoundWelcomeScreen]
14445
13892
  });
@@ -14463,7 +13910,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
14463
13910
  onDragOver,
14464
13911
  onDragLeave,
14465
13912
  onDrop,
14466
- className: cn("copilotKitChat cpk-chat-view", className),
13913
+ className: (0, _copilotkit_core.ɵcn)("copilotKitChat cpk-chat-view", className),
14467
13914
  ...props,
14468
13915
  children: [
14469
13916
  dragOver && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropOverlay, {}),
@@ -14620,7 +14067,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
14620
14067
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollElementContext.Provider, {
14621
14068
  value: nonAutoScrollEl,
14622
14069
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14623
- className: cn("cpk-chat-view-scroll-area", className),
14070
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-view-scroll-area", className),
14624
14071
  children: [
14625
14072
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14626
14073
  ref: nonAutoScrollRefCallback,
@@ -14651,7 +14098,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
14651
14098
  });
14652
14099
  };
14653
14100
  _CopilotChatView.ScrollView = ({ children, autoScroll = "pin-to-bottom", scrollThreadId, scrollToBottomButton, feather, inputContainerHeight = 0, isResizing = false, className, ...props }) => {
14654
- const mode = normalizeAutoScroll(autoScroll);
14101
+ const mode = (0, _copilotkit_core.ɵnormalizeAutoScroll)(autoScroll);
14655
14102
  const [hasMounted, setHasMounted] = (0, react.useState)(false);
14656
14103
  const scrollRef = (0, react.useRef)(null);
14657
14104
  const contentRef = (0, react.useRef)(null);
@@ -14702,7 +14149,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
14702
14149
  value: nonAutoScrollEl,
14703
14150
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14704
14151
  ref: nonAutoScrollRefCallback,
14705
- className: cn("cpk-chat-view-scroll-area cpk-chat-view-scroll-viewport", className),
14152
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-view-scroll-area cpk-chat-view-scroll-viewport", className),
14706
14153
  ...props,
14707
14154
  children: [
14708
14155
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -14736,7 +14183,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
14736
14183
  children
14737
14184
  });
14738
14185
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(use_stick_to_bottom.StickToBottom, {
14739
- className: cn("cpk-chat-view-scroll-view", className),
14186
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-view-scroll-view", className),
14740
14187
  resize: "smooth",
14741
14188
  initial: "smooth",
14742
14189
  ...props,
@@ -14756,7 +14203,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
14756
14203
  "data-testid": "copilot-scroll-to-bottom",
14757
14204
  variant: "outline",
14758
14205
  size: "sm",
14759
- className: cn("cpk-chat-view-scroll-to-bottom-button", className),
14206
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-view-scroll-to-bottom-button", className),
14760
14207
  "aria-label": labels.chatScrollToBottomLabel,
14761
14208
  ...props,
14762
14209
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotIcon, {
@@ -14774,7 +14221,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
14774
14221
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14775
14222
  "data-testid": "copilot-connecting-indicator",
14776
14223
  role: "status",
14777
- className: cn("cpk-chat-view-connecting-indicator", className),
14224
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-view-connecting-indicator", className),
14778
14225
  ...props,
14779
14226
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotIcon, {
14780
14227
  name: "Loader2",
@@ -14788,7 +14235,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
14788
14235
  _CopilotChatView.WelcomeMessage = ({ className, ...props }) => {
14789
14236
  const labels = useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
14790
14237
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
14791
- className: cn("cpk-chat-view-welcome-message", className),
14238
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-view-welcome-message", className),
14792
14239
  ...props,
14793
14240
  children: labels.welcomeMessageText
14794
14241
  });
@@ -14808,7 +14255,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
14808
14255
  });
14809
14256
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
14810
14257
  "data-testid": "copilot-welcome-screen",
14811
- className: cn("cpk-chat-view-welcome-screen", className),
14258
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-view-welcome-screen", className),
14812
14259
  ...props,
14813
14260
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14814
14261
  className: "cpk-chat-view-welcome-screen-content",
@@ -15694,7 +15141,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
15694
15141
  "data-testid": "copilot-chat-toggle",
15695
15142
  "data-slot": "chat-toggle-button",
15696
15143
  "data-state": isOpen ? "open" : "closed",
15697
- className: cn("copilotKitButton cpk-chat-toggle-button", className),
15144
+ className: (0, _copilotkit_core.ɵcn)("copilotKitButton cpk-chat-toggle-button", className),
15698
15145
  "aria-label": isOpen ? labels.chatToggleCloseLabel : labels.chatToggleOpenLabel,
15699
15146
  "aria-pressed": isOpen,
15700
15147
  disabled,
@@ -15750,14 +15197,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
15750
15197
  */
15751
15198
  function useIsMobileViewport() {
15752
15199
  const [isMobile, setIsMobile] = (0, react.useState)(false);
15753
- (0, react.useEffect)(() => {
15754
- if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
15755
- const mql = window.matchMedia("(max-width: 767px)");
15756
- const update = () => setIsMobile(mql.matches);
15757
- update();
15758
- mql.addEventListener("change", update);
15759
- return () => mql.removeEventListener("change", update);
15760
- }, []);
15200
+ (0, react.useEffect)(() => (0, _copilotkit_core.ɵwatchMobileViewport)(setIsMobile), []);
15761
15201
  return isMobile;
15762
15202
  }
15763
15203
  function CopilotModalHeader({ title, titleContent, closeButton, drawerLauncher, children, className, ...rest }) {
@@ -15788,7 +15228,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
15788
15228
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
15789
15229
  "data-testid": "copilot-modal-header",
15790
15230
  "data-slot": "copilot-modal-header",
15791
- className: cn("copilotKitHeader cpk-modal-header", className),
15231
+ className: (0, _copilotkit_core.ɵcn)("copilotKitHeader cpk-modal-header", className),
15792
15232
  ...rest,
15793
15233
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
15794
15234
  className: "cpk-modal-header-content",
@@ -15813,7 +15253,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
15813
15253
  (function(_CopilotModalHeader) {
15814
15254
  _CopilotModalHeader.Title = ({ children, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
15815
15255
  "data-testid": "copilot-header-title",
15816
- className: cn("cpk-modal-header-title", className),
15256
+ className: (0, _copilotkit_core.ɵcn)("cpk-modal-header-title", className),
15817
15257
  ...props,
15818
15258
  children
15819
15259
  });
@@ -15822,7 +15262,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
15822
15262
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
15823
15263
  type: "button",
15824
15264
  "data-testid": "copilot-close-button",
15825
- className: cn("cpk-modal-header-close-button", className),
15265
+ className: (0, _copilotkit_core.ɵcn)("cpk-modal-header-close-button", className),
15826
15266
  "aria-label": labels.modalHeaderCloseButtonLabel,
15827
15267
  ...props,
15828
15268
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotIcon, {
@@ -15837,7 +15277,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
15837
15277
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
15838
15278
  type: "button",
15839
15279
  "data-testid": "copilot-threads-drawer-launcher",
15840
- className: cn("cpk-modal-header-drawer-launcher", className),
15280
+ className: (0, _copilotkit_core.ɵcn)("cpk-modal-header-drawer-launcher", className),
15841
15281
  "aria-label": labels.modalHeaderThreadsButtonLabel,
15842
15282
  ...props,
15843
15283
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotIcon, {
@@ -15939,7 +15379,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
15939
15379
  "data-testid": "copilot-sidebar",
15940
15380
  "data-copilot-sidebar": true,
15941
15381
  "data-position": position,
15942
- className: cn("copilotKitSidebar copilotKitWindow cpk-sidebar-view", !isSidebarOpen && "cpk-sidebar-view-closed"),
15382
+ className: (0, _copilotkit_core.ɵcn)("copilotKitSidebar copilotKitWindow cpk-sidebar-view", !isSidebarOpen && "cpk-sidebar-view-closed"),
15943
15383
  style: {
15944
15384
  "--sidebar-width": widthToCss(sidebarWidth),
15945
15385
  paddingTop: "env(safe-area-inset-top)",
@@ -15974,7 +15414,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
15974
15414
  })
15975
15415
  });
15976
15416
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
15977
- className: cn("cpk-sidebar-view-welcome-screen", className),
15417
+ className: (0, _copilotkit_core.ɵcn)("cpk-sidebar-view-welcome-screen", className),
15978
15418
  ...props,
15979
15419
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
15980
15420
  className: "cpk-sidebar-view-welcome-screen-message",
@@ -16108,14 +15548,14 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
16108
15548
  "aria-label": labels.modalHeaderTitle,
16109
15549
  "data-testid": "copilot-popup",
16110
15550
  "data-copilot-popup": true,
16111
- className: cn("copilotKitPopup copilotKitWindow cpk-popup-view-window", isPopupOpen && !isAnimatingOut && "cpk-popup-view-window-open"),
15551
+ className: (0, _copilotkit_core.ɵcn)("copilotKitPopup copilotKitWindow cpk-popup-view-window", isPopupOpen && !isAnimatingOut && "cpk-popup-view-window-open"),
16112
15552
  style: popupStyle,
16113
15553
  children: [headerElement, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
16114
15554
  className: "cpk-popup-view-chat",
16115
15555
  "data-popup-chat": true,
16116
15556
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChatView_default, {
16117
15557
  ...restProps,
16118
- className: cn("cpk-popup-view-chat-view", className)
15558
+ className: (0, _copilotkit_core.ɵcn)("cpk-popup-view-chat-view", className)
16119
15559
  })
16120
15560
  })]
16121
15561
  })
@@ -16137,7 +15577,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
16137
15577
  })
16138
15578
  });
16139
15579
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
16140
- className: cn("cpk-popup-view-welcome-screen", className),
15580
+ className: (0, _copilotkit_core.ɵcn)("cpk-popup-view-welcome-screen", className),
16141
15581
  ...props,
16142
15582
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
16143
15583
  className: "cpk-popup-view-welcome-screen-message",
@@ -18021,18 +17461,96 @@ Object.defineProperty(exports, 'ɵCOPILOTKIT_FEATURES', {
18021
17461
  return _copilotkit_core.ɵCOPILOTKIT_FEATURES;
18022
17462
  }
18023
17463
  });
17464
+ Object.defineProperty(exports, 'ɵCOPY_FEEDBACK_RESET_MS', {
17465
+ enumerable: true,
17466
+ get: function () {
17467
+ return _copilotkit_core.ɵCOPY_FEEDBACK_RESET_MS;
17468
+ }
17469
+ });
17470
+ Object.defineProperty(exports, 'ɵCopyFeedback', {
17471
+ enumerable: true,
17472
+ get: function () {
17473
+ return _copilotkit_core.ɵCopyFeedback;
17474
+ }
17475
+ });
17476
+ Object.defineProperty(exports, 'ɵFEEDBACK_COMMENT_CLOSE_DELAY_MS', {
17477
+ enumerable: true,
17478
+ get: function () {
17479
+ return _copilotkit_core.ɵFEEDBACK_COMMENT_CLOSE_DELAY_MS;
17480
+ }
17481
+ });
17482
+ Object.defineProperty(exports, 'ɵFeedbackCommentController', {
17483
+ enumerable: true,
17484
+ get: function () {
17485
+ return _copilotkit_core.ɵFeedbackCommentController;
17486
+ }
17487
+ });
17488
+ Object.defineProperty(exports, 'ɵHOVER_MENU_CLOSE_DELAY_MS', {
17489
+ enumerable: true,
17490
+ get: function () {
17491
+ return _copilotkit_core.ɵHOVER_MENU_CLOSE_DELAY_MS;
17492
+ }
17493
+ });
17494
+ Object.defineProperty(exports, 'ɵHoverMenuController', {
17495
+ enumerable: true,
17496
+ get: function () {
17497
+ return _copilotkit_core.ɵHoverMenuController;
17498
+ }
17499
+ });
17500
+ Object.defineProperty(exports, 'ɵINLINE_FEATURE_WARNING_STYLE', {
17501
+ enumerable: true,
17502
+ get: function () {
17503
+ return _copilotkit_core.ɵINLINE_FEATURE_WARNING_STYLE;
17504
+ }
17505
+ });
18024
17506
  Object.defineProperty(exports, 'ɵInterruptState', {
18025
17507
  enumerable: true,
18026
17508
  get: function () {
18027
17509
  return _copilotkit_core.ɵInterruptState;
18028
17510
  }
18029
17511
  });
17512
+ Object.defineProperty(exports, 'ɵKEYBOARD_OPEN_THRESHOLD_PX', {
17513
+ enumerable: true,
17514
+ get: function () {
17515
+ return _copilotkit_core.ɵKEYBOARD_OPEN_THRESHOLD_PX;
17516
+ }
17517
+ });
17518
+ Object.defineProperty(exports, 'ɵLICENSE_BANNER_OFFSET', {
17519
+ enumerable: true,
17520
+ get: function () {
17521
+ return _copilotkit_core.ɵLICENSE_BANNER_OFFSET;
17522
+ }
17523
+ });
17524
+ Object.defineProperty(exports, 'ɵLICENSE_BANNER_STYLE', {
17525
+ enumerable: true,
17526
+ get: function () {
17527
+ return _copilotkit_core.ɵLICENSE_BANNER_STYLE;
17528
+ }
17529
+ });
18030
17530
  Object.defineProperty(exports, 'ɵMAX_SOCKET_RETRIES', {
18031
17531
  enumerable: true,
18032
17532
  get: function () {
18033
17533
  return _copilotkit_core.ɵMAX_SOCKET_RETRIES;
18034
17534
  }
18035
17535
  });
17536
+ Object.defineProperty(exports, 'ɵMESSAGE_FEEDBACK_EVENT_NAME', {
17537
+ enumerable: true,
17538
+ get: function () {
17539
+ return _copilotkit_core.ɵMESSAGE_FEEDBACK_EVENT_NAME;
17540
+ }
17541
+ });
17542
+ Object.defineProperty(exports, 'ɵMESSAGE_FEEDBACK_MAX_COMMENT_LENGTH', {
17543
+ enumerable: true,
17544
+ get: function () {
17545
+ return _copilotkit_core.ɵMESSAGE_FEEDBACK_MAX_COMMENT_LENGTH;
17546
+ }
17547
+ });
17548
+ Object.defineProperty(exports, 'ɵMOBILE_MAX_WIDTH_QUERY', {
17549
+ enumerable: true,
17550
+ get: function () {
17551
+ return _copilotkit_core.ɵMOBILE_MAX_WIDTH_QUERY;
17552
+ }
17553
+ });
18036
17554
  Object.defineProperty(exports, 'ɵOpenGenerativeUIController', {
18037
17555
  enumerable: true,
18038
17556
  get: function () {
@@ -18057,6 +17575,12 @@ Object.defineProperty(exports, 'ɵclearAgentInterruptState', {
18057
17575
  return _copilotkit_core.ɵclearAgentInterruptState;
18058
17576
  }
18059
17577
  });
17578
+ Object.defineProperty(exports, 'ɵcn', {
17579
+ enumerable: true,
17580
+ get: function () {
17581
+ return _copilotkit_core.ɵcn;
17582
+ }
17583
+ });
18060
17584
  Object.defineProperty(exports, 'ɵcomposerButtonState', {
18061
17585
  enumerable: true,
18062
17586
  get: function () {
@@ -18111,6 +17635,12 @@ Object.defineProperty(exports, 'ɵextractCompleteStyles', {
18111
17635
  return _copilotkit_core.ɵextractCompleteStyles;
18112
17636
  }
18113
17637
  });
17638
+ Object.defineProperty(exports, 'ɵflattenUserMessageContent', {
17639
+ enumerable: true,
17640
+ get: function () {
17641
+ return _copilotkit_core.ɵflattenUserMessageContent;
17642
+ }
17643
+ });
18114
17644
  Object.defineProperty(exports, 'ɵformatCountLabel', {
18115
17645
  enumerable: true,
18116
17646
  get: function () {
@@ -18129,6 +17659,12 @@ Object.defineProperty(exports, 'ɵformatReasoningDuration', {
18129
17659
  return _copilotkit_core.ɵformatReasoningDuration;
18130
17660
  }
18131
17661
  });
17662
+ Object.defineProperty(exports, 'ɵformatReasoningDurationLabel', {
17663
+ enumerable: true,
17664
+ get: function () {
17665
+ return _copilotkit_core.ɵformatReasoningDurationLabel;
17666
+ }
17667
+ });
18132
17668
  Object.defineProperty(exports, 'ɵformatToolNames', {
18133
17669
  enumerable: true,
18134
17670
  get: function () {
@@ -18153,12 +17689,42 @@ Object.defineProperty(exports, 'ɵgetArgumentPreview', {
18153
17689
  return _copilotkit_core.ɵgetArgumentPreview;
18154
17690
  }
18155
17691
  });
17692
+ Object.defineProperty(exports, 'ɵgetBranchNavState', {
17693
+ enumerable: true,
17694
+ get: function () {
17695
+ return _copilotkit_core.ɵgetBranchNavState;
17696
+ }
17697
+ });
17698
+ Object.defineProperty(exports, 'ɵgetInlineFeatureWarningSpec', {
17699
+ enumerable: true,
17700
+ get: function () {
17701
+ return _copilotkit_core.ɵgetInlineFeatureWarningSpec;
17702
+ }
17703
+ });
18156
17704
  Object.defineProperty(exports, 'ɵgetLatestTurnKey', {
18157
17705
  enumerable: true,
18158
17706
  get: function () {
18159
17707
  return _copilotkit_core.ɵgetLatestTurnKey;
18160
17708
  }
18161
17709
  });
17710
+ Object.defineProperty(exports, 'ɵgetLicenseBannerSpec', {
17711
+ enumerable: true,
17712
+ get: function () {
17713
+ return _copilotkit_core.ɵgetLicenseBannerSpec;
17714
+ }
17715
+ });
17716
+ Object.defineProperty(exports, 'ɵgetMessageFeedback', {
17717
+ enumerable: true,
17718
+ get: function () {
17719
+ return _copilotkit_core.ɵgetMessageFeedback;
17720
+ }
17721
+ });
17722
+ Object.defineProperty(exports, 'ɵgetMessageFeedbackControls', {
17723
+ enumerable: true,
17724
+ get: function () {
17725
+ return _copilotkit_core.ɵgetMessageFeedbackControls;
17726
+ }
17727
+ });
18162
17728
  Object.defineProperty(exports, 'ɵgetToolCallLayouts', {
18163
17729
  enumerable: true,
18164
17730
  get: function () {
@@ -18195,12 +17761,60 @@ Object.defineProperty(exports, 'ɵgetTurnWork', {
18195
17761
  return _copilotkit_core.ɵgetTurnWork;
18196
17762
  }
18197
17763
  });
17764
+ Object.defineProperty(exports, 'ɵgetUserMessageMediaFilename', {
17765
+ enumerable: true,
17766
+ get: function () {
17767
+ return _copilotkit_core.ɵgetUserMessageMediaFilename;
17768
+ }
17769
+ });
17770
+ Object.defineProperty(exports, 'ɵgetUserMessageMediaParts', {
17771
+ enumerable: true,
17772
+ get: function () {
17773
+ return _copilotkit_core.ɵgetUserMessageMediaParts;
17774
+ }
17775
+ });
18198
17776
  Object.defineProperty(exports, 'ɵgetWorkOpenState', {
18199
17777
  enumerable: true,
18200
17778
  get: function () {
18201
17779
  return _copilotkit_core.ɵgetWorkOpenState;
18202
17780
  }
18203
17781
  });
17782
+ Object.defineProperty(exports, 'ɵgetWorkSummaryText', {
17783
+ enumerable: true,
17784
+ get: function () {
17785
+ return _copilotkit_core.ɵgetWorkSummaryText;
17786
+ }
17787
+ });
17788
+ Object.defineProperty(exports, 'ɵhasAssistantMessageText', {
17789
+ enumerable: true,
17790
+ get: function () {
17791
+ return _copilotkit_core.ɵhasAssistantMessageText;
17792
+ }
17793
+ });
17794
+ Object.defineProperty(exports, 'ɵinitialKeyboardState', {
17795
+ enumerable: true,
17796
+ get: function () {
17797
+ return _copilotkit_core.ɵinitialKeyboardState;
17798
+ }
17799
+ });
17800
+ Object.defineProperty(exports, 'ɵinspectorKiteFill', {
17801
+ enumerable: true,
17802
+ get: function () {
17803
+ return _copilotkit_core.ɵinspectorKiteFill;
17804
+ }
17805
+ });
17806
+ Object.defineProperty(exports, 'ɵinspectorKiteIcon', {
17807
+ enumerable: true,
17808
+ get: function () {
17809
+ return _copilotkit_core.ɵinspectorKiteIcon;
17810
+ }
17811
+ });
17812
+ Object.defineProperty(exports, 'ɵinspectorShortcuts', {
17813
+ enumerable: true,
17814
+ get: function () {
17815
+ return _copilotkit_core.ɵinspectorShortcuts;
17816
+ }
17817
+ });
18204
17818
  Object.defineProperty(exports, 'ɵisCopilotKitFeature', {
18205
17819
  enumerable: true,
18206
17820
  get: function () {
@@ -18213,6 +17827,18 @@ Object.defineProperty(exports, 'ɵisHttpAgent', {
18213
17827
  return _copilotkit_core.ɵisHttpAgent;
18214
17828
  }
18215
17829
  });
17830
+ Object.defineProperty(exports, 'ɵisLearningFeedbackEnabled', {
17831
+ enumerable: true,
17832
+ get: function () {
17833
+ return _copilotkit_core.ɵisLearningFeedbackEnabled;
17834
+ }
17835
+ });
17836
+ Object.defineProperty(exports, 'ɵisMobileViewport', {
17837
+ enumerable: true,
17838
+ get: function () {
17839
+ return _copilotkit_core.ɵisMobileViewport;
17840
+ }
17841
+ });
18216
17842
  Object.defineProperty(exports, 'ɵisRetryableMemoryStatus', {
18217
17843
  enumerable: true,
18218
17844
  get: function () {
@@ -18279,6 +17905,12 @@ Object.defineProperty(exports, 'ɵmessagesFingerprint', {
18279
17905
  return _copilotkit_core.ɵmessagesFingerprint;
18280
17906
  }
18281
17907
  });
17908
+ Object.defineProperty(exports, 'ɵnormalizeAutoScroll', {
17909
+ enumerable: true,
17910
+ get: function () {
17911
+ return _copilotkit_core.ɵnormalizeAutoScroll;
17912
+ }
17913
+ });
18282
17914
  Object.defineProperty(exports, 'ɵobservePhoenixEvent$', {
18283
17915
  enumerable: true,
18284
17916
  get: function () {
@@ -18315,6 +17947,12 @@ Object.defineProperty(exports, 'ɵphoenixSocket$', {
18315
17947
  return _copilotkit_core.ɵphoenixSocket$;
18316
17948
  }
18317
17949
  });
17950
+ Object.defineProperty(exports, 'ɵpinMessageToTop', {
17951
+ enumerable: true,
17952
+ get: function () {
17953
+ return _copilotkit_core.ɵpinMessageToTop;
17954
+ }
17955
+ });
18318
17956
  Object.defineProperty(exports, 'ɵpluralize', {
18319
17957
  enumerable: true,
18320
17958
  get: function () {
@@ -18327,12 +17965,30 @@ Object.defineProperty(exports, 'ɵprocessPartialHtml', {
18327
17965
  return _copilotkit_core.ɵprocessPartialHtml;
18328
17966
  }
18329
17967
  });
17968
+ Object.defineProperty(exports, 'ɵreadKeyboardState', {
17969
+ enumerable: true,
17970
+ get: function () {
17971
+ return _copilotkit_core.ɵreadKeyboardState;
17972
+ }
17973
+ });
18330
17974
  Object.defineProperty(exports, 'ɵrecordWorkTime', {
18331
17975
  enumerable: true,
18332
17976
  get: function () {
18333
17977
  return _copilotkit_core.ɵrecordWorkTime;
18334
17978
  }
18335
17979
  });
17980
+ Object.defineProperty(exports, 'ɵreserveLicenseBannerOffset', {
17981
+ enumerable: true,
17982
+ get: function () {
17983
+ return _copilotkit_core.ɵreserveLicenseBannerOffset;
17984
+ }
17985
+ });
17986
+ Object.defineProperty(exports, 'ɵresetMessageFeedbackCache', {
17987
+ enumerable: true,
17988
+ get: function () {
17989
+ return _copilotkit_core.ɵresetMessageFeedbackCache;
17990
+ }
17991
+ });
18336
17992
  Object.defineProperty(exports, 'ɵresolveActivityRenderer', {
18337
17993
  enumerable: true,
18338
17994
  get: function () {
@@ -18453,12 +18109,42 @@ Object.defineProperty(exports, 'ɵselectThreadsIsLoading', {
18453
18109
  return _copilotkit_core.ɵselectThreadsIsLoading;
18454
18110
  }
18455
18111
  });
18112
+ Object.defineProperty(exports, 'ɵsetMessageFeedback', {
18113
+ enumerable: true,
18114
+ get: function () {
18115
+ return _copilotkit_core.ɵsetMessageFeedback;
18116
+ }
18117
+ });
18118
+ Object.defineProperty(exports, 'ɵshallowEqualRecord', {
18119
+ enumerable: true,
18120
+ get: function () {
18121
+ return _copilotkit_core.ɵshallowEqualRecord;
18122
+ }
18123
+ });
18124
+ Object.defineProperty(exports, 'ɵshouldShowAssistantToolbar', {
18125
+ enumerable: true,
18126
+ get: function () {
18127
+ return _copilotkit_core.ɵshouldShowAssistantToolbar;
18128
+ }
18129
+ });
18456
18130
  Object.defineProperty(exports, 'ɵstringifyToolCallPayload', {
18457
18131
  enumerable: true,
18458
18132
  get: function () {
18459
18133
  return _copilotkit_core.ɵstringifyToolCallPayload;
18460
18134
  }
18461
18135
  });
18136
+ Object.defineProperty(exports, 'ɵsubscribeToLearningFeedbackEnabled', {
18137
+ enumerable: true,
18138
+ get: function () {
18139
+ return _copilotkit_core.ɵsubscribeToLearningFeedbackEnabled;
18140
+ }
18141
+ });
18142
+ Object.defineProperty(exports, 'ɵsubscribeToMessageFeedback', {
18143
+ enumerable: true,
18144
+ get: function () {
18145
+ return _copilotkit_core.ɵsubscribeToMessageFeedback;
18146
+ }
18147
+ });
18462
18148
  Object.defineProperty(exports, 'ɵthreadAdapterEvents', {
18463
18149
  enumerable: true,
18464
18150
  get: function () {
@@ -18477,6 +18163,18 @@ Object.defineProperty(exports, 'ɵtranscriptionErrorMessageKey', {
18477
18163
  return _copilotkit_core.ɵtranscriptionErrorMessageKey;
18478
18164
  }
18479
18165
  });
18166
+ Object.defineProperty(exports, 'ɵwatchKeyboardState', {
18167
+ enumerable: true,
18168
+ get: function () {
18169
+ return _copilotkit_core.ɵwatchKeyboardState;
18170
+ }
18171
+ });
18172
+ Object.defineProperty(exports, 'ɵwatchMobileViewport', {
18173
+ enumerable: true,
18174
+ get: function () {
18175
+ return _copilotkit_core.ɵwatchMobileViewport;
18176
+ }
18177
+ });
18480
18178
  Object.defineProperty(exports, 'ɵwithHeaderDefaults', {
18481
18179
  enumerable: true,
18482
18180
  get: function () {