@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.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_MarkdownSurfaces = require('./MarkdownSurfaces-Ci0E7XKw.cjs');
4
+ const require_MarkdownSurfaces = require('./MarkdownSurfaces-CoUoPhR9.cjs');
5
5
  let _copilotkit_core = require("@copilotkit/core");
6
6
  let _ag_ui_client = require("@ag-ui/client");
7
7
  let react = require("react");
@@ -53,7 +53,7 @@ const sizeClasses = {
53
53
  * followed by `className`.
54
54
  */
55
55
  function buttonVariants({ variant, size, className, class: classProp } = {}) {
56
- return require_MarkdownSurfaces.cn("cpk-button", variant !== null && variantClasses[variant ?? "default"], size !== null && sizeClasses[size ?? "default"], classProp, className);
56
+ return (0, _copilotkit_core.ɵcn)("cpk-button", variant !== null && variantClasses[variant ?? "default"], size !== null && sizeClasses[size ?? "default"], classProp, className);
57
57
  }
58
58
  const Button = react.forwardRef(function Button({ className, variant, size, ...props }, ref) {
59
59
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
@@ -95,7 +95,7 @@ function TooltipContent({ className, sideOffset = 0, children, ...props }) {
95
95
  "data-copilotkit": true,
96
96
  "data-slot": "tooltip-content",
97
97
  sideOffset,
98
- className: require_MarkdownSurfaces.cn("cpk-tooltip", className),
98
+ className: (0, _copilotkit_core.ɵcn)("cpk-tooltip", className),
99
99
  ...props,
100
100
  children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tooltip.Arrow, { className: "cpk-tooltip-arrow" })]
101
101
  }) });
@@ -121,7 +121,7 @@ function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
121
121
  "data-copilotkit": true,
122
122
  "data-slot": "dropdown-menu-content",
123
123
  sideOffset,
124
- className: require_MarkdownSurfaces.cn("cpk-dropdown-menu-content", className),
124
+ className: (0, _copilotkit_core.ɵcn)("cpk-dropdown-menu-content", className),
125
125
  ...props
126
126
  }) });
127
127
  }
@@ -130,7 +130,7 @@ function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
130
130
  "data-slot": "dropdown-menu-item",
131
131
  "data-inset": inset,
132
132
  "data-variant": variant,
133
- className: require_MarkdownSurfaces.cn("cpk-dropdown-menu-item", className),
133
+ className: (0, _copilotkit_core.ɵcn)("cpk-dropdown-menu-item", className),
134
134
  ...props
135
135
  });
136
136
  }
@@ -138,14 +138,14 @@ function DropdownMenuLabel({ className, inset, ...props }) {
138
138
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Label, {
139
139
  "data-slot": "dropdown-menu-label",
140
140
  "data-inset": inset,
141
- className: require_MarkdownSurfaces.cn("cpk-dropdown-menu-label", className),
141
+ className: (0, _copilotkit_core.ɵcn)("cpk-dropdown-menu-label", className),
142
142
  ...props
143
143
  });
144
144
  }
145
145
  function DropdownMenuSeparator({ className, ...props }) {
146
146
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Separator, {
147
147
  "data-slot": "dropdown-menu-separator",
148
- className: require_MarkdownSurfaces.cn("cpk-dropdown-menu-separator", className),
148
+ className: (0, _copilotkit_core.ɵcn)("cpk-dropdown-menu-separator", className),
149
149
  ...props
150
150
  });
151
151
  }
@@ -159,7 +159,7 @@ function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
159
159
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dropdown_menu.SubTrigger, {
160
160
  "data-slot": "dropdown-menu-sub-trigger",
161
161
  "data-inset": inset,
162
- className: require_MarkdownSurfaces.cn("cpk-dropdown-menu-sub-trigger", className),
162
+ className: (0, _copilotkit_core.ɵcn)("cpk-dropdown-menu-sub-trigger", className),
163
163
  ...props,
164
164
  children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
165
165
  name: "ChevronRight",
@@ -170,7 +170,7 @@ function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
170
170
  function DropdownMenuSubContent({ className, ...props }) {
171
171
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.SubContent, {
172
172
  "data-slot": "dropdown-menu-sub-content",
173
- className: require_MarkdownSurfaces.cn("cpk-dropdown-menu-sub-content", className),
173
+ className: (0, _copilotkit_core.ɵcn)("cpk-dropdown-menu-sub-content", className),
174
174
  ...props
175
175
  });
176
176
  }
@@ -365,7 +365,7 @@ const CopilotChatAudioRecorder = (0, react.forwardRef)((props, ref) => {
365
365
  cleanup
366
366
  ]);
367
367
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
368
- className: require_MarkdownSurfaces.cn("cpk-audio-recorder", className),
368
+ className: (0, _copilotkit_core.ɵcn)("cpk-audio-recorder", className),
369
369
  ...divProps,
370
370
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("canvas", {
371
371
  ref: canvasRef,
@@ -925,7 +925,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
925
925
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
926
926
  "data-copilotkit": true,
927
927
  ref: containerRef,
928
- className: require_MarkdownSurfaces.cn("cpk-chat-input", positioning === "absolute" && "cpk-chat-input-absolute", className),
928
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-input", positioning === "absolute" && "cpk-chat-input-absolute", className),
929
929
  style: {
930
930
  transform: keyboardHeight > 0 ? `translateY(-${keyboardHeight}px)` : void 0,
931
931
  transition: "transform 0.2s ease-out",
@@ -948,7 +948,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
948
948
  "data-testid": "copilot-send-button",
949
949
  variant: "chatInputToolbarPrimary",
950
950
  size: "chatInputToolbarIcon",
951
- className: require_MarkdownSurfaces.cn("cpk-chat-input-send-button", className),
951
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-input-send-button", className),
952
952
  "aria-label": labels.chatInputToolbarSendButtonLabel,
953
953
  ...props,
954
954
  children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
@@ -966,7 +966,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
966
966
  type: "button",
967
967
  variant: "chatInputToolbarSecondary",
968
968
  size: "chatInputToolbarIcon",
969
- className: require_MarkdownSurfaces.cn(defaultClassName, className),
969
+ className: (0, _copilotkit_core.ɵcn)(defaultClassName, className),
970
970
  "aria-label": labels[labelKey],
971
971
  ...props,
972
972
  children: icon
@@ -1045,7 +1045,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
1045
1045
  "data-testid": "copilot-add-menu-button",
1046
1046
  variant: "chatInputToolbarSecondary",
1047
1047
  size: "chatInputToolbarIcon",
1048
- className: require_MarkdownSurfaces.cn("cpk-chat-input-add-menu-button", className),
1048
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-input-add-menu-button", className),
1049
1049
  disabled: isDisabled,
1050
1050
  "aria-label": labels.chatInputToolbarAddButtonLabel,
1051
1051
  ...props,
@@ -1087,7 +1087,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
1087
1087
  ref: internalTextareaRef,
1088
1088
  "data-testid": "copilot-chat-textarea",
1089
1089
  placeholder: placeholder ?? labels.chatInputPlaceholder,
1090
- className: require_MarkdownSurfaces.cn("cpk-chat-input-textarea", className),
1090
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-input-textarea", className),
1091
1091
  style: {
1092
1092
  overflow: "auto",
1093
1093
  resize: "none",
@@ -1101,7 +1101,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
1101
1101
  _CopilotChatInput.Disclaimer = ({ className, ...props }) => {
1102
1102
  const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
1103
1103
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1104
- className: require_MarkdownSurfaces.cn("cpk-chat-input-disclaimer", className),
1104
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-input-disclaimer", className),
1105
1105
  ...props,
1106
1106
  children: labels.chatDisclaimerText
1107
1107
  });
@@ -1242,7 +1242,7 @@ function useRenderToolCall() {
1242
1242
 
1243
1243
  //#endregion
1244
1244
  //#region package.json
1245
- var version$1 = "2.0.0-rc.19";
1245
+ var version$1 = "2.0.0-rc.20";
1246
1246
 
1247
1247
  //#endregion
1248
1248
  //#region src/components/CopilotKitInspector.tsx
@@ -1313,164 +1313,51 @@ function useCopilotKitInspector() {
1313
1313
 
1314
1314
  //#endregion
1315
1315
  //#region src/components/license-warning-banner.tsx
1316
- const labels = _copilotkit_core.CopilotChatDefaultLabels;
1316
+ /** The chat labels in effect, or the default ones outside a chat. */
1317
+ function useLabels$2() {
1318
+ return require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
1319
+ }
1317
1320
  /**
1318
- * The "expires soon" banner text. Without a day count it says "soon", never
1319
- * "in undefined days".
1321
+ * The fixed license banner. Core's `ɵgetLicenseBannerSpec` picks its text,
1322
+ * link, and severity; this component renders them.
1320
1323
  */
1321
- function expiringMessage(graceRemaining) {
1322
- if (graceRemaining === void 0) return labels.licenseExpiringText;
1323
- return (0, _copilotkit_core.ɵformatLabel)(graceRemaining === 1 ? labels.licenseExpiringInDaysOne : labels.licenseExpiringInDaysOther, { days: graceRemaining });
1324
- }
1325
- const LICENSE_BANNER_OFFSET_PX = 52;
1326
- const LICENSE_BANNER_OFFSET_VAR = "--copilotkit-license-banner-offset";
1327
- const BANNER_STYLES = {
1328
- base: {
1329
- position: "fixed",
1330
- bottom: "8px",
1331
- left: "50%",
1332
- transform: "translateX(-50%)",
1333
- zIndex: 99999,
1334
- display: "inline-flex",
1335
- alignItems: "center",
1336
- gap: "12px",
1337
- whiteSpace: "nowrap",
1338
- padding: "8px 16px",
1339
- fontSize: "13px",
1340
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif",
1341
- borderRadius: "6px",
1342
- boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)"
1343
- },
1344
- info: {
1345
- backgroundColor: "#eff6ff",
1346
- border: "1px solid #93c5fd",
1347
- color: "#1e40af"
1348
- },
1349
- warning: {
1350
- backgroundColor: "#fffbeb",
1351
- border: "1px solid #fbbf24",
1352
- color: "#92400e"
1353
- },
1354
- critical: {
1355
- backgroundColor: "#fef2f2",
1356
- border: "1px solid #fca5a5",
1357
- color: "#991b1b"
1358
- }
1359
- };
1360
- function getSeverityStyle(severity) {
1361
- switch (severity) {
1362
- case "warning": return BANNER_STYLES.warning;
1363
- case "critical": return BANNER_STYLES.critical;
1364
- default: return BANNER_STYLES.info;
1365
- }
1366
- }
1367
- function BannerShell({ severity, message, actionLabel, actionUrl, onDismiss }) {
1368
- (0, react.useEffect)(() => {
1369
- if (typeof document === "undefined") return;
1370
- const root = document.documentElement;
1371
- root.style.setProperty(LICENSE_BANNER_OFFSET_VAR, `${LICENSE_BANNER_OFFSET_PX}px`);
1372
- return () => {
1373
- root.style.removeProperty(LICENSE_BANNER_OFFSET_VAR);
1374
- };
1375
- }, []);
1324
+ function LicenseWarningBanner({ type, onDismiss, ...details }) {
1325
+ const spec = (0, _copilotkit_core.ɵgetLicenseBannerSpec)(type, useLabels$2(), details);
1326
+ (0, react.useEffect)(() => (0, _copilotkit_core.ɵreserveLicenseBannerOffset)(), []);
1376
1327
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1377
1328
  style: {
1378
- ...BANNER_STYLES.base,
1379
- ...getSeverityStyle(severity)
1329
+ ..._copilotkit_core.ɵLICENSE_BANNER_STYLE.base,
1330
+ ..._copilotkit_core.ɵLICENSE_BANNER_STYLE.severity[spec.severity]
1380
1331
  },
1381
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: message }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1382
- style: {
1383
- display: "flex",
1384
- gap: "8px",
1385
- alignItems: "center"
1386
- },
1332
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: spec.message }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1333
+ style: _copilotkit_core.ɵLICENSE_BANNER_STYLE.actions,
1387
1334
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
1388
- href: actionUrl,
1335
+ href: spec.actionUrl,
1389
1336
  target: "_blank",
1390
1337
  rel: "noopener noreferrer",
1391
- style: {
1392
- fontWeight: 600,
1393
- textDecoration: "underline",
1394
- color: "inherit"
1395
- },
1396
- children: actionLabel
1338
+ style: _copilotkit_core.ɵLICENSE_BANNER_STYLE.link,
1339
+ children: spec.actionLabel
1397
1340
  }), onDismiss && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1398
1341
  onClick: onDismiss,
1399
- style: {
1400
- background: "none",
1401
- border: "none",
1402
- cursor: "pointer",
1403
- color: "inherit",
1404
- fontSize: "16px"
1405
- },
1342
+ style: _copilotkit_core.ɵLICENSE_BANNER_STYLE.dismiss,
1406
1343
  children: "×"
1407
1344
  })]
1408
1345
  })]
1409
1346
  });
1410
1347
  }
1411
- function LicenseWarningBanner({ type, featureName, expiryDate, graceRemaining, onDismiss }) {
1412
- switch (type) {
1413
- case "no_license": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerShell, {
1414
- severity: "info",
1415
- message: labels.licensePoweredByText,
1416
- actionLabel: labels.licenseGetLicenseLabel,
1417
- actionUrl: "https://copilotkit.ai/pricing",
1418
- onDismiss
1419
- });
1420
- case "feature_unlicensed": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerShell, {
1421
- severity: "warning",
1422
- message: (0, _copilotkit_core.ɵformatLabel)(labels.licenseFeatureUnlicensedText, { feature: featureName ?? "" }),
1423
- actionLabel: labels.licenseGetLicenseLabel,
1424
- actionUrl: "https://copilotkit.ai/pricing",
1425
- onDismiss
1426
- });
1427
- case "expiring": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerShell, {
1428
- severity: "warning",
1429
- message: expiringMessage(graceRemaining),
1430
- actionLabel: labels.licenseRenewLabel,
1431
- actionUrl: "https://dashboard.operations.copilotkit.ai",
1432
- onDismiss
1433
- });
1434
- case "expired": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerShell, {
1435
- severity: "critical",
1436
- message: expiryDate ? (0, _copilotkit_core.ɵformatLabel)(labels.licenseExpiredOnDateText, { date: expiryDate }) : labels.licenseExpiredText,
1437
- actionLabel: labels.licenseRenewNowLabel,
1438
- actionUrl: "https://copilotkit.ai/pricing",
1439
- onDismiss
1440
- });
1441
- case "invalid": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerShell, {
1442
- severity: "critical",
1443
- message: labels.licenseInvalidText,
1444
- actionLabel: labels.licenseGetLicenseLabel,
1445
- actionUrl: "https://copilotkit.ai/pricing",
1446
- onDismiss
1447
- });
1448
- default: return null;
1449
- }
1450
- }
1451
1348
  function InlineFeatureWarning({ featureName }) {
1349
+ const spec = (0, _copilotkit_core.ɵgetInlineFeatureWarningSpec)(featureName, useLabels$2());
1452
1350
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1453
- style: {
1454
- padding: "8px 12px",
1455
- backgroundColor: "#fffbeb",
1456
- border: "1px solid #fbbf24",
1457
- borderRadius: "6px",
1458
- fontSize: "13px",
1459
- color: "#92400e",
1460
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif"
1461
- },
1351
+ style: _copilotkit_core.ɵINLINE_FEATURE_WARNING_STYLE.container,
1462
1352
  children: [
1463
- (0, _copilotkit_core.ɵformatLabel)(labels.licenseFeatureUnlicensedText, { feature: featureName }),
1353
+ spec.message,
1464
1354
  " ",
1465
1355
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
1466
- href: "https://copilotkit.ai/pricing",
1356
+ href: spec.actionUrl,
1467
1357
  target: "_blank",
1468
1358
  rel: "noopener noreferrer",
1469
- style: {
1470
- color: "#b45309",
1471
- textDecoration: "underline"
1472
- },
1473
- children: "Get one at copilotkit.ai/pricing"
1359
+ style: _copilotkit_core.ɵINLINE_FEATURE_WARNING_STYLE.link,
1360
+ children: spec.actionLabel
1474
1361
  })
1475
1362
  ]
1476
1363
  });
@@ -5497,7 +5384,7 @@ function Collapsible({ open, id, className, children }) {
5497
5384
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5498
5385
  ref,
5499
5386
  id,
5500
- className: require_MarkdownSurfaces.cn("cpk-collapsible", className),
5387
+ className: (0, _copilotkit_core.ɵcn)("cpk-collapsible", className),
5501
5388
  style: { gridTemplateRows: open ? "1fr" : "0fr" },
5502
5389
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5503
5390
  className: "cpk-collapsible-content",
@@ -5509,14 +5396,14 @@ function StatusIcon({ status, className }) {
5509
5396
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
5510
5397
  name: STATUS_ICONS[status],
5511
5398
  "aria-hidden": "true",
5512
- className: require_MarkdownSurfaces.cn("cpk-tool-call-status-icon", status === "running" && "cpk-tool-call-status-icon-running", status === "failed" && "cpk-tool-call-status-icon-failed", className)
5399
+ 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)
5513
5400
  });
5514
5401
  }
5515
5402
  function Chevron({ open, className }) {
5516
5403
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
5517
5404
  name: "ChevronRight",
5518
5405
  "aria-hidden": "true",
5519
- className: require_MarkdownSurfaces.cn("cpk-tool-call-chevron", open && "cpk-tool-call-chevron-open", className)
5406
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-chevron", open && "cpk-tool-call-chevron-open", className)
5520
5407
  });
5521
5408
  }
5522
5409
  function FailedCount({ calls }) {
@@ -5544,7 +5431,7 @@ function Payload({ label, value }) {
5544
5431
  function ToolCallPayloads({ parameters, result, className }) {
5545
5432
  const labels = useLabels$1();
5546
5433
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5547
- className: require_MarkdownSurfaces.cn("cpk-tool-call-payloads", className),
5434
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-payloads", className),
5548
5435
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Payload, {
5549
5436
  label: labels.toolCallArgumentsLabel,
5550
5437
  value: parameters ?? {}
@@ -5566,7 +5453,7 @@ function ToolCallRow({ name, parameters, result, status, appearance, className,
5566
5453
  const preview = (0, _copilotkit_core.ɵgetArgumentPreview)(parameters);
5567
5454
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5568
5455
  "data-copilotkit": true,
5569
- className: require_MarkdownSurfaces.cn("cpk-tool-call-row", `cpk-tool-call-row-${appearance}`, className),
5456
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-row", `cpk-tool-call-row-${appearance}`, className),
5570
5457
  ...props,
5571
5458
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
5572
5459
  type: "button",
@@ -5578,7 +5465,7 @@ function ToolCallRow({ name, parameters, result, status, appearance, className,
5578
5465
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusIcon, { status }),
5579
5466
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5580
5467
  "data-testid": "copilot-tool-render-name",
5581
- className: require_MarkdownSurfaces.cn("cpk-tool-call-row-name", status === "running" && "cpk-shimmer"),
5468
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-row-name", status === "running" && "cpk-shimmer"),
5582
5469
  children: name
5583
5470
  }),
5584
5471
  preview && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -5653,7 +5540,7 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
5653
5540
  if (appearance === "line") {
5654
5541
  if (calls.length === 1 && !current) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5655
5542
  ...groupProps,
5656
- className: require_MarkdownSurfaces.cn("cpk-tool-call-group cpk-tool-call-group-line cpk-tool-call-group-single", className),
5543
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-group cpk-tool-call-group-line cpk-tool-call-group-single", className),
5657
5544
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolCallGroupContext.Provider, {
5658
5545
  value: {
5659
5546
  appearance: "line",
@@ -5665,7 +5552,7 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
5665
5552
  });
5666
5553
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5667
5554
  ...groupProps,
5668
- className: require_MarkdownSurfaces.cn("cpk-tool-call-group cpk-tool-call-group-line", className),
5555
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-group cpk-tool-call-group-line", className),
5669
5556
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
5670
5557
  type: "button",
5671
5558
  "aria-expanded": open,
@@ -5703,7 +5590,7 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
5703
5590
  const latestPreview = (0, _copilotkit_core.ɵgetToolCallPreview)(latest);
5704
5591
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5705
5592
  ...groupProps,
5706
- className: require_MarkdownSurfaces.cn("cpk-tool-call-group cpk-tool-call-group-stack", className),
5593
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-group cpk-tool-call-group-stack", className),
5707
5594
  style: {
5708
5595
  paddingBottom: behind * 6,
5709
5596
  ...props.style
@@ -5713,7 +5600,7 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
5713
5600
  children: [
5714
5601
  Array.from({ length: behind }, (_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5715
5602
  "aria-hidden": "true",
5716
- className: require_MarkdownSurfaces.cn(layer, "cpk-tool-call-group-stack-behind"),
5603
+ className: (0, _copilotkit_core.ɵcn)(layer, "cpk-tool-call-group-stack-behind"),
5717
5604
  style: {
5718
5605
  transform: `translateY(${(index + 1) * 6}px) scaleX(${1 - (index + 1) * .045})`,
5719
5606
  zIndex: -1 - index,
@@ -5725,7 +5612,7 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
5725
5612
  "aria-expanded": open,
5726
5613
  "aria-controls": open ? bodyId : void 0,
5727
5614
  onClick: () => setOpen((value) => !value),
5728
- className: require_MarkdownSurfaces.cn("cpk-tool-call-group-stack-toggle", open ? "cpk-tool-call-group-stack-toggle-open" : [layer, "cpk-tool-call-group-stack-toggle-closed"]),
5615
+ 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"]),
5729
5616
  children: open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
5730
5617
  (0, _copilotkit_core.ɵformatCountLabel)(calls.length, {
5731
5618
  one: labels.toolCallToolCallCountOne,
@@ -5744,7 +5631,7 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
5744
5631
  children: [
5745
5632
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusIcon, { status: latestStatus }),
5746
5633
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5747
- className: require_MarkdownSurfaces.cn("cpk-tool-call-group-stack-name", latestStatus === "running" && "cpk-shimmer"),
5634
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-group-stack-name", latestStatus === "running" && "cpk-shimmer"),
5748
5635
  children: latest.toolCall.function.name
5749
5636
  }),
5750
5637
  latestPreview && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -5790,7 +5677,7 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
5790
5677
  active: isActive
5791
5678
  },
5792
5679
  children: calls.map((call, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5793
- className: require_MarkdownSurfaces.cn(layer, "cpk-tool-call-group-stack-item"),
5680
+ className: (0, _copilotkit_core.ɵcn)(layer, "cpk-tool-call-group-stack-item"),
5794
5681
  style: { animationDelay: `${index * 30}ms` },
5795
5682
  children: renderCall(call)
5796
5683
  }, call.toolCall.id))
@@ -5800,7 +5687,7 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
5800
5687
  }
5801
5688
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5802
5689
  ...groupProps,
5803
- className: require_MarkdownSurfaces.cn("cpk-tool-call-group cpk-tool-call-group-card", className),
5690
+ className: (0, _copilotkit_core.ɵcn)("cpk-tool-call-group cpk-tool-call-group-card", className),
5804
5691
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
5805
5692
  type: "button",
5806
5693
  "aria-expanded": open,
@@ -5979,7 +5866,7 @@ function DefaultToolCallRenderer({ name, toolCallId, parameters, status, result
5979
5866
  className: "cpk-default-tool-call-title",
5980
5867
  children: [
5981
5868
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
5982
- className: require_MarkdownSurfaces.cn("cpk-default-tool-call-chevron", isExpanded && "cpk-default-tool-call-chevron-open"),
5869
+ className: (0, _copilotkit_core.ɵcn)("cpk-default-tool-call-chevron", isExpanded && "cpk-default-tool-call-chevron-open"),
5983
5870
  fill: "none",
5984
5871
  viewBox: "0 0 24 24",
5985
5872
  strokeWidth: 2,
@@ -7594,160 +7481,53 @@ function CopilotChatToolCallsView({ message, messages = [], display: displayProp
7594
7481
 
7595
7482
  //#endregion
7596
7483
  //#region src/components/chat/CopilotChatInspectorButton.tsx
7597
- let shortcutsHidden = false;
7598
- const listeners$1 = /* @__PURE__ */ new Set();
7599
- const subscribe = (listener) => {
7600
- listeners$1.add(listener);
7601
- return () => {
7602
- listeners$1.delete(listener);
7603
- };
7604
- };
7605
- const getSnapshot = () => shortcutsHidden;
7606
- const getServerSnapshot = () => false;
7484
+ const subscribeToShortcuts = (listener) => _copilotkit_core.ɵinspectorShortcuts.subscribe(listener);
7485
+ const getShortcutsHidden = () => _copilotkit_core.ɵinspectorShortcuts.hidden;
7486
+ const getServerShortcutsHidden = () => false;
7487
+ /** Whether the user hid the Inspector shortcuts until the page reloads. */
7607
7488
  function useInspectorShortcutsHidden() {
7608
- return (0, react.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
7609
- }
7610
- function hideShortcuts() {
7611
- shortcutsHidden = true;
7612
- listeners$1.forEach((listener) => listener());
7489
+ return (0, react.useSyncExternalStore)(subscribeToShortcuts, getShortcutsHidden, getServerShortcutsHidden);
7613
7490
  }
7491
+ const hideShortcuts = () => _copilotkit_core.ɵinspectorShortcuts.hide();
7614
7492
  function InspectorKiteIcon({ className, ...props }) {
7615
7493
  const id = (0, react.useId)();
7616
7494
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
7617
7495
  ...props,
7618
7496
  "aria-hidden": "true",
7619
- className: require_MarkdownSurfaces.cn("cpk-inspector-button-kite-icon", className),
7620
- viewBox: "4.57 3.36 17.8 17.8",
7497
+ className: (0, _copilotkit_core.ɵcn)("cpk-inspector-button-kite-icon", className),
7498
+ viewBox: _copilotkit_core.ɵinspectorKiteIcon.viewBox,
7621
7499
  fill: "none",
7622
- children: [
7623
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
7624
- 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",
7625
- fill: `url(#${id}-paint0_linear)`
7626
- }),
7627
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
7628
- 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",
7629
- fill: `url(#${id}-paint1_linear)`
7630
- }),
7631
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
7632
- 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",
7633
- fill: `url(#${id}-paint2_linear)`
7634
- }),
7635
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
7636
- d: "M10.7145 3.79041L17.8305 20.7659",
7637
- stroke: "#513C9F",
7638
- strokeWidth: "0.17284",
7639
- strokeLinecap: "round"
7640
- }),
7641
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
7642
- 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",
7643
- stroke: "#513C9F",
7644
- strokeWidth: "0.17284",
7645
- strokeLinecap: "round"
7646
- }),
7647
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
7648
- d: "M11.6914 5.93518L9.05534 14.7068M9.05534 14.7068H15.3203M9.05534 14.7068L0.15625 26.3646",
7649
- stroke: "#ABABAB",
7650
- strokeWidth: "0.302474",
7651
- strokeLinecap: "round"
7652
- }),
7653
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
7654
- 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",
7655
- fill: `url(#${id}-paint3_linear)`
7656
- }),
7657
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("defs", { children: [
7658
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
7659
- id: `${id}-paint0_linear`,
7660
- x1: "15.5372",
7661
- y1: "5.0278",
7662
- x2: "12.0802",
7663
- y2: "14.534",
7664
- gradientUnits: "userSpaceOnUse",
7665
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { stopColor: "#6430AB" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
7666
- offset: "1",
7667
- stopColor: "#AA89D8"
7668
- })]
7669
- }),
7670
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
7671
- id: `${id}-paint1_linear`,
7672
- x1: "12.8583",
7673
- y1: "10.3858",
7674
- x2: "8.40764",
7675
- y2: "18.9846",
7676
- gradientUnits: "userSpaceOnUse",
7677
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { stopColor: "#005DBB" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
7678
- offset: "1",
7679
- stopColor: "#3D92E8"
7680
- })]
7681
- }),
7682
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
7683
- id: `${id}-paint2_linear`,
7684
- x1: "14.8452",
7685
- y1: "5.02774",
7686
- x2: "13.5047",
7687
- y2: "9.21911",
7688
- gradientUnits: "userSpaceOnUse",
7689
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { stopColor: "#1B70C4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
7690
- offset: "1",
7691
- stopColor: "#54A4F2"
7692
- })]
7693
- }),
7694
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
7695
- id: `${id}-paint3_linear`,
7696
- x1: "4.85806",
7697
- y1: "24.2455",
7698
- x2: "18.9963",
7699
- y2: "24.2455",
7700
- gradientUnits: "userSpaceOnUse",
7701
- children: [
7702
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { stopColor: "#4497EA" }),
7703
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
7704
- offset: "0.254755",
7705
- stopColor: "#1463B2"
7706
- }),
7707
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
7708
- offset: "0.498725",
7709
- stopColor: "#0A437D"
7710
- }),
7711
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
7712
- offset: "0.666667",
7713
- stopColor: "#2476C8"
7714
- }),
7715
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
7716
- offset: "0.972542",
7717
- stopColor: "#0C549A"
7718
- })
7719
- ]
7720
- })
7721
- ] })
7722
- ]
7500
+ children: [_copilotkit_core.ɵinspectorKiteIcon.paths.map((path) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
7501
+ d: path.d,
7502
+ fill: (0, _copilotkit_core.ɵinspectorKiteFill)(id, path),
7503
+ stroke: path.stroke,
7504
+ strokeWidth: path.strokeWidth,
7505
+ strokeLinecap: path.strokeLinecap
7506
+ }, path.d)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("defs", { children: _copilotkit_core.ɵinspectorKiteIcon.gradients.map((gradient) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("linearGradient", {
7507
+ id: `${id}-${gradient.id}`,
7508
+ x1: gradient.x1,
7509
+ y1: gradient.y1,
7510
+ x2: gradient.x2,
7511
+ y2: gradient.y2,
7512
+ gradientUnits: "userSpaceOnUse",
7513
+ children: gradient.stops.map((stop) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
7514
+ offset: stop.offset,
7515
+ stopColor: stop.color
7516
+ }, `${stop.offset ?? "0"}-${stop.color}`))
7517
+ }, gradient.id)) })]
7723
7518
  });
7724
7519
  }
7725
7520
  function CopilotChatInspectorButton({ title, className, onClick, onPointerDown, onPointerEnter, onPointerLeave, onKeyDown, disabled, ...props }) {
7726
7521
  const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
7727
7522
  const { isInspectorEnabled } = useCopilotKitInspector();
7728
7523
  const hidden = useInspectorShortcutsHidden();
7729
- const [open, setOpen] = (0, react.useState)(false);
7730
- const [dark, setDark] = (0, react.useState)(false);
7524
+ const [menu] = (0, react.useState)(() => new _copilotkit_core.ɵHoverMenuController());
7525
+ const { open, dark } = (0, react.useSyncExternalStore)(menu.subscribe, menu.getSnapshot, menu.getSnapshot);
7731
7526
  const trigger = (0, react.useRef)(null);
7732
- const closeTimer = (0, react.useRef)(null);
7733
- const openedByHover = (0, react.useRef)(false);
7734
7527
  const primaryLabel = title || labels.assistantMessageToolbarInspectorLabel;
7735
- const cancelClose = () => {
7736
- if (closeTimer.current !== null) clearTimeout(closeTimer.current);
7737
- closeTimer.current = null;
7738
- };
7739
- (0, react.useEffect)(() => cancelClose, []);
7740
- const changeOpen = (next) => {
7741
- cancelClose();
7742
- if (next) setDark(!!trigger.current?.closest(".dark"));
7743
- setOpen(next);
7744
- };
7745
- const scheduleClose = () => {
7746
- cancelClose();
7747
- closeTimer.current = setTimeout(() => {
7748
- if (openedByHover.current) setOpen(false);
7749
- }, 180);
7750
- };
7528
+ (0, react.useEffect)(() => menu.dispose, [menu]);
7529
+ const { cancelClose, scheduleClose } = menu;
7530
+ const changeOpen = (next) => menu.setOpen(next, trigger.current);
7751
7531
  if (!isInspectorEnabled || hidden) return null;
7752
7532
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownMenu, {
7753
7533
  open,
@@ -7764,13 +7544,14 @@ function CopilotChatInspectorButton({ title, className, onClick, onPointerDown,
7764
7544
  size: "icon",
7765
7545
  "data-testid": "copilot-inspector-button",
7766
7546
  "aria-label": `${labels.assistantMessageToolbarInspectorTitle} (${labels.assistantMessageToolbarInspectorLocalOnlyLabel.toLowerCase()})`,
7767
- className: require_MarkdownSurfaces.cn("cpk-inspector-button", className),
7547
+ className: (0, _copilotkit_core.ɵcn)("cpk-inspector-button", className),
7768
7548
  onPointerEnter: (event) => {
7769
7549
  onPointerEnter?.(event);
7770
- if (!disabled && event.pointerType !== "touch") {
7771
- openedByHover.current = true;
7772
- changeOpen(true);
7773
- }
7550
+ menu.pointerEnter({
7551
+ pointerType: event.pointerType,
7552
+ disabled,
7553
+ trigger: trigger.current
7554
+ });
7774
7555
  },
7775
7556
  onPointerLeave: (event) => {
7776
7557
  onPointerLeave?.(event);
@@ -7785,7 +7566,7 @@ function CopilotChatInspectorButton({ title, className, onClick, onPointerDown,
7785
7566
  onClick?.(event);
7786
7567
  },
7787
7568
  onKeyDown: (event) => {
7788
- openedByHover.current = false;
7569
+ menu.keyboardUsed();
7789
7570
  onKeyDown?.(event);
7790
7571
  if (!event.defaultPrevented && (event.key === "Enter" || event.key === " ")) {
7791
7572
  event.preventDefault();
@@ -7803,17 +7584,15 @@ function CopilotChatInspectorButton({ title, className, onClick, onPointerDown,
7803
7584
  align: "start",
7804
7585
  side: "top",
7805
7586
  sideOffset: 6,
7806
- className: require_MarkdownSurfaces.cn("cpk-inspector-button-menu", dark && "dark"),
7587
+ className: (0, _copilotkit_core.ɵcn)("cpk-inspector-button-menu", dark && "dark"),
7807
7588
  onPointerEnter: cancelClose,
7808
7589
  onPointerLeave: scheduleClose,
7809
- onKeyDown: () => {
7810
- openedByHover.current = false;
7811
- },
7590
+ onKeyDown: menu.keyboardUsed,
7812
7591
  onOpenAutoFocus: (event) => {
7813
- if (openedByHover.current) event.preventDefault();
7592
+ if (menu.openedByHover) event.preventDefault();
7814
7593
  },
7815
7594
  onCloseAutoFocus: (event) => {
7816
- if (openedByHover.current) event.preventDefault();
7595
+ if (menu.openedByHover) event.preventDefault();
7817
7596
  },
7818
7597
  onFocusOutside: () => changeOpen(false),
7819
7598
  children: [
@@ -7834,7 +7613,7 @@ function CopilotChatInspectorButton({ title, className, onClick, onPointerDown,
7834
7613
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipContent, {
7835
7614
  side: "top",
7836
7615
  sideOffset: 6,
7837
- className: require_MarkdownSurfaces.cn("cpk-inspector-button-local-tooltip", dark && "dark"),
7616
+ className: (0, _copilotkit_core.ɵcn)("cpk-inspector-button-local-tooltip", dark && "dark"),
7838
7617
  onPointerEnter: cancelClose,
7839
7618
  onPointerLeave: scheduleClose,
7840
7619
  children: labels.assistantMessageToolbarInspectorLocalOnlyDescription
@@ -7902,87 +7681,11 @@ const PopoverContent = react.forwardRef(({ className, align = "start", sideOffse
7902
7681
  "data-slot": "popover-content",
7903
7682
  align,
7904
7683
  sideOffset,
7905
- className: require_MarkdownSurfaces.cn("cpk-popover", className),
7684
+ className: (0, _copilotkit_core.ɵcn)("cpk-popover", className),
7906
7685
  ...props
7907
7686
  }) }));
7908
7687
  PopoverContent.displayName = "PopoverContent";
7909
7688
 
7910
- //#endregion
7911
- //#region src/lib/message-feedback.ts
7912
- /** Trajectory event name for a rating of one assistant message. */
7913
- const MESSAGE_FEEDBACK_EVENT_NAME = "message.feedback";
7914
- /** Longest comment kept, in characters; the rest is cut so the event stays small. */
7915
- const MESSAGE_FEEDBACK_MAX_COMMENT_LENGTH = 1e3;
7916
- /** Longest excerpt of the rated response sent with the rating, in characters. */
7917
- const RESPONSE_EXCERPT_LENGTH = 500;
7918
- const ratings = /* @__PURE__ */ new Map();
7919
- const listeners = /* @__PURE__ */ new Map();
7920
- const threadKey = (agentId, threadId) => JSON.stringify([agentId, threadId]);
7921
- const messageKey = (agentId, threadId, messageId) => JSON.stringify([
7922
- agentId,
7923
- threadId,
7924
- messageId
7925
- ]);
7926
- /** Cuts `text` to `max` characters without splitting a surrogate pair. */
7927
- const clip = (text, max) => {
7928
- const characters = Array.from(text);
7929
- return characters.length > max ? characters.slice(0, max).join("") : text;
7930
- };
7931
- /** The comment as kept and sent: trimmed and capped, or none. */
7932
- const normalizeComment = (comment) => {
7933
- if (typeof comment !== "string") return void 0;
7934
- const text = clip(comment.trim(), MESSAGE_FEEDBACK_MAX_COMMENT_LENGTH);
7935
- return text === "" ? void 0 : text;
7936
- };
7937
- /** The rating this page gave one message, if any. */
7938
- function getMessageFeedback(agentId, threadId, messageId) {
7939
- return ratings.get(messageKey(agentId, threadId, messageId));
7940
- }
7941
- /** Calls `listener` whenever a rating in this Thread changes. */
7942
- function subscribeToMessageFeedback(agentId, threadId, listener) {
7943
- const key = threadKey(agentId, threadId);
7944
- let set = listeners.get(key);
7945
- if (set === void 0) {
7946
- set = /* @__PURE__ */ new Set();
7947
- listeners.set(key, set);
7948
- }
7949
- set.add(listener);
7950
- return () => {
7951
- set.delete(listener);
7952
- if (set.size === 0) listeners.delete(key);
7953
- };
7954
- }
7955
- /**
7956
- * Sets (or, with `null`, clears) this page's rating of one message and sends
7957
- * it to the active Trajectory. Every change is a new event; the newest event
7958
- * for a `feedbackId` is the current one. Like any Trajectory event, a change
7959
- * made while no Trajectory captures, for example during a reconnect, is not
7960
- * sent; the page still shows it.
7961
- */
7962
- function setMessageFeedback(params) {
7963
- const { copilotkit, agentId, threadId, message } = params;
7964
- const comment = normalizeComment(params.feedback?.comment);
7965
- const feedback = params.feedback && {
7966
- rating: params.feedback.rating,
7967
- ...comment ? { comment } : {}
7968
- };
7969
- const key = messageKey(agentId, threadId, message.id);
7970
- if (feedback) ratings.set(key, feedback);
7971
- else ratings.delete(key);
7972
- for (const listener of listeners.get(threadKey(agentId, threadId)) ?? []) listener();
7973
- const runId = copilotkit.getRunIdForMessage(agentId, threadId, message.id);
7974
- copilotkit.emitTrajectoryEvent(MESSAGE_FEEDBACK_EVENT_NAME, {
7975
- feedbackId: `${threadId}:${message.id}`,
7976
- threadId,
7977
- messageId: message.id,
7978
- agentId,
7979
- ...runId ? { runId } : {},
7980
- rating: feedback?.rating ?? null,
7981
- ...feedback?.comment ? { comment: feedback.comment } : {},
7982
- ...copilotkit.ɵlearningCapturesAgentText ? { response: clip(message.content ?? "", RESPONSE_EXCERPT_LENGTH) } : {}
7983
- });
7984
- }
7985
-
7986
7689
  //#endregion
7987
7690
  //#region src/components/chat/message-feedback.tsx
7988
7691
  /**
@@ -7991,180 +7694,61 @@ function setMessageFeedback(params) {
7991
7694
  * or thumb slots.
7992
7695
  */
7993
7696
  const MessageFeedbackScopeContext = (0, react.createContext)(null);
7994
- const capturedCores = /* @__PURE__ */ new WeakSet();
7995
- const rememberCapture = (copilotkit) => {
7996
- if (capturedCores.has(copilotkit)) return;
7997
- capturedCores.add(copilotkit);
7998
- const unsubscribe = copilotkit.ɵsubscribeToLearningConfigured(() => {
7999
- if (copilotkit.ɵlearningConfigured) return;
8000
- capturedCores.delete(copilotkit);
8001
- unsubscribe();
8002
- });
8003
- };
8004
7697
  /**
8005
- * Whether the thumbs record feedback for Learning. True once a Trajectory of
8006
- * this Core has started and as long as Learning stays configured, also while
8007
- * capture reconnects or is stopped, so the buttons do not flicker. Ratings
8008
- * given meanwhile still show but, like any Trajectory event, are not
8009
- * sent. A capture that never starts (for example without a license) leaves it
8010
- * false.
7698
+ * Whether the thumbs record feedback for Learning. See core's
7699
+ * `ɵisLearningFeedbackEnabled` for the rules.
8011
7700
  */
8012
7701
  function useLearningFeedbackEnabled(copilotkit) {
8013
- const configured = (0, react.useSyncExternalStore)((0, react.useCallback)((onChange) => copilotkit.ɵsubscribeToLearningConfigured(onChange), [copilotkit]), () => copilotkit.ɵlearningConfigured, () => false);
8014
- const capturing = (0, react.useSyncExternalStore)((0, react.useCallback)((onChange) => copilotkit.subscribe({ onTrajectoryChanged: onChange }).unsubscribe, [copilotkit]), () => copilotkit.trajectoryId !== null, () => false);
8015
- (0, react.useEffect)(() => {
8016
- if (capturing) rememberCapture(copilotkit);
8017
- }, [capturing, copilotkit]);
8018
- return configured && (capturing || capturedCores.has(copilotkit));
7702
+ return (0, react.useSyncExternalStore)((0, react.useCallback)((onChange) => (0, _copilotkit_core.ɵsubscribeToLearningFeedbackEnabled)(copilotkit, onChange), [copilotkit]), () => (0, _copilotkit_core.ɵisLearningFeedbackEnabled)(copilotkit), () => false);
8019
7703
  }
8020
7704
  const noSubscription = () => () => {};
8021
7705
  /** Feedback controls for `message`, or `null` when this chat collects none. */
8022
7706
  function useMessageFeedback(message) {
8023
7707
  const scope = (0, react.useContext)(MessageFeedbackScopeContext);
8024
- const subscribe = (0, react.useCallback)((onChange) => scope ? subscribeToMessageFeedback(scope.agentId, scope.threadId, onChange) : noSubscription(), [scope]);
8025
- const getSnapshot = () => scope ? getMessageFeedback(scope.agentId, scope.threadId, message.id) : void 0;
8026
- const feedback = (0, react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
8027
- if (!scope) return null;
8028
- const save = (next) => setMessageFeedback({
8029
- ...scope,
8030
- message,
8031
- feedback: next
8032
- });
8033
- return {
8034
- feedback,
8035
- rate: (rating) => {
8036
- if (feedback?.rating !== rating) save({ rating });
8037
- },
8038
- clear: () => {
8039
- if (feedback) save(null);
8040
- },
8041
- comment: (comment) => {
8042
- if (feedback) save({
8043
- rating: feedback.rating,
8044
- comment
8045
- });
8046
- }
8047
- };
7708
+ const subscribe = (0, react.useCallback)((onChange) => scope ? (0, _copilotkit_core.ɵsubscribeToMessageFeedback)(scope.agentId, scope.threadId, onChange) : noSubscription(), [scope]);
7709
+ const getSnapshot = () => scope ? (0, _copilotkit_core.ɵgetMessageFeedback)(scope.agentId, scope.threadId, message.id) : void 0;
7710
+ (0, react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
7711
+ return scope ? (0, _copilotkit_core.ɵgetMessageFeedbackControls)(scope, message) : null;
8048
7712
  }
8049
7713
  /**
8050
- * How long the pointer may be away from the rating and its comment before the
8051
- * comment closes: enough to cross the gap between them, short enough that
8052
- * passing over a rating does not leave it open.
8053
- */
8054
- const FEEDBACK_COMMENT_CLOSE_DELAY_MS = 150;
8055
- /**
8056
- * Drives the comment popover of a rated message.
8057
- *
8058
- * It opens when a rating is given and whenever the pointer or keyboard focus
8059
- * reaches the chosen thumb, with the saved comment in the field. It closes by
8060
- * itself shortly after the pointer leaves the thumb and the popover, unless
8061
- * focus is in the field: then it stays until focus moves away, Enter, or
8062
- * Escape. Closing saves a changed comment; Escape, a click on a thumb, and
8063
- * removing the rating discard it.
7714
+ * Drives the comment popover of a rated message with core's
7715
+ * `ɵFeedbackCommentController`, which holds the open and close rules.
8064
7716
  */
8065
7717
  function useFeedbackComment(controls) {
8066
- const [open, setOpen] = (0, react.useState)(false);
8067
- const [draft, setDraft] = (0, react.useState)("");
8068
- const [focusRequest, setFocusRequest] = (0, react.useState)(0);
7718
+ const latestControls = (0, react.useRef)(controls);
7719
+ latestControls.current = controls;
7720
+ const [controller] = (0, react.useState)(() => new _copilotkit_core.ɵFeedbackCommentController({ getControls: () => latestControls.current }));
8069
7721
  const inputRef = (0, react.useRef)(null);
8070
- const timer = (0, react.useRef)(void 0);
8071
- const editing = (0, react.useRef)(false);
8072
- const focusWaiting = (0, react.useRef)(false);
8073
- const pointerOver = (0, react.useRef)(false);
8074
- const returning = (0, react.useRef)(false);
8075
- const latest = (0, react.useRef)({
8076
- controls,
8077
- draft,
8078
- open
8079
- });
8080
- latest.current = {
8081
- ...latest.current,
8082
- controls,
8083
- draft,
8084
- open
8085
- };
8086
- const takeFocusRequest = (0, react.useCallback)(() => {
8087
- const waiting = focusWaiting.current;
8088
- focusWaiting.current = false;
8089
- return waiting;
8090
- }, []);
8091
- const cancelClose = (0, react.useCallback)(() => {
8092
- if (timer.current === void 0) return;
8093
- clearTimeout(timer.current);
8094
- timer.current = void 0;
8095
- }, []);
8096
- (0, react.useEffect)(() => cancelClose, [cancelClose]);
8097
- const savedComment = (0, react.useCallback)(() => latest.current.controls?.feedback?.comment ?? "", []);
8098
- (0, react.useEffect)(() => () => {
8099
- const { open: wasOpen, controls: current, draft: text } = latest.current;
8100
- if (wasOpen && current?.feedback && text.trim() !== savedComment()) current.comment(text);
8101
- }, []);
8102
- const close = (0, react.useCallback)(({ save = true } = {}) => {
8103
- cancelClose();
8104
- focusWaiting.current = false;
8105
- pointerOver.current = false;
8106
- if (!latest.current.open) return;
8107
- const current = latest.current.controls;
8108
- if (save && current?.feedback && latest.current.draft.trim() !== savedComment()) current.comment(latest.current.draft);
8109
- editing.current = false;
8110
- latest.current = {
8111
- ...latest.current,
8112
- open: false
8113
- };
8114
- setOpen(false);
8115
- }, [cancelClose, savedComment]);
8116
- const show = ({ comment, focus }) => {
8117
- cancelClose();
8118
- latest.current = {
8119
- ...latest.current,
8120
- open: true,
8121
- draft: comment
8122
- };
8123
- setDraft(comment);
8124
- if (focus) {
8125
- focusWaiting.current = true;
8126
- setFocusRequest((request) => request + 1);
8127
- }
8128
- setOpen(true);
8129
- };
7722
+ const state = (0, react.useSyncExternalStore)(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
7723
+ (0, react.useEffect)(() => controller.dispose, [controller]);
8130
7724
  return {
8131
- open,
8132
- draft,
8133
- setDraft,
8134
- focusRequest,
8135
- takeFocusRequest,
7725
+ ...state,
7726
+ setDraft: controller.setDraft,
7727
+ takeFocusRequest: controller.takeFocusRequest,
8136
7728
  inputRef,
8137
- show,
8138
- enter: (via = "focus") => {
8139
- cancelClose();
8140
- if (via === "pointer") pointerOver.current = true;
8141
- if (returning.current) return;
8142
- if (!latest.current.open && latest.current.controls?.feedback) show({
8143
- comment: savedComment(),
8144
- focus: false
8145
- });
8146
- },
8147
- leave: (via = "focus") => {
8148
- if (via === "pointer") pointerOver.current = false;
8149
- else if (pointerOver.current) return;
8150
- cancelClose();
8151
- timer.current = setTimeout(() => {
8152
- timer.current = void 0;
8153
- if (!editing.current) close();
8154
- }, FEEDBACK_COMMENT_CLOSE_DELAY_MS);
8155
- },
8156
- setEditing: (value) => {
8157
- editing.current = value;
8158
- },
8159
- close,
8160
- returnFocus: (target) => {
8161
- returning.current = true;
8162
- try {
8163
- target?.focus();
8164
- } finally {
8165
- returning.current = false;
8166
- }
8167
- }
7729
+ show: controller.show,
7730
+ enter: controller.enter,
7731
+ leave: controller.leave,
7732
+ setEditing: controller.setEditing,
7733
+ close: controller.close,
7734
+ returnFocus: controller.returnFocus
7735
+ };
7736
+ }
7737
+
7738
+ //#endregion
7739
+ //#region src/components/chat/use-copy-feedback.ts
7740
+ /**
7741
+ * The "copied" check mark of a copy button, from core's `ɵCopyFeedback`: it
7742
+ * shows for two seconds after `markCopied()`, and a second copy restarts the
7743
+ * wait.
7744
+ */
7745
+ function useCopyFeedback() {
7746
+ const [feedback] = (0, react.useState)(() => new _copilotkit_core.ɵCopyFeedback());
7747
+ const copied = (0, react.useSyncExternalStore)(feedback.subscribe, feedback.getSnapshot, feedback.getSnapshot);
7748
+ (0, react.useEffect)(() => feedback.dispose, [feedback]);
7749
+ return {
7750
+ copied,
7751
+ markCopied: feedback.markCopied
8168
7752
  };
8169
7753
  }
8170
7754
 
@@ -8327,7 +7911,7 @@ function FeedbackCommentPopover({ feedbackComment, comment, savedComment, rating
8327
7911
  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 }) {
8328
7912
  const providerRenderer = require_MarkdownSurfaces.useShallowStableRef(require_MarkdownSurfaces.useMarkdownRenderer());
8329
7913
  const DefaultMarkdownRenderer = (0, react.useMemo)(() => resolveMarkdownRenderer(providerRenderer), [providerRenderer]);
8330
- const hasContent = !!(message.content && message.content.trim().length > 0);
7914
+ const hasContent = (0, _copilotkit_core.ɵhasAssistantMessageText)(message.content);
8331
7915
  const isLatestAssistantMessage = message.role === "assistant" && (isLatest ?? messages?.[messages.length - 1]?.id === message.id);
8332
7916
  const { isInspectorEnabled, openInspector } = useCopilotKitInspector();
8333
7917
  const shortcutsHidden = useInspectorShortcutsHidden();
@@ -8447,7 +8031,13 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
8447
8031
  message,
8448
8032
  messages
8449
8033
  });
8450
- const shouldShowToolbar = toolbarVisible && (hasContent || showInspectorShortcut) && !(isRunning && isLatestAssistantMessage);
8034
+ const shouldShowToolbar = (0, _copilotkit_core.ɵshouldShowAssistantToolbar)({
8035
+ toolbarVisible,
8036
+ hasContent,
8037
+ showInspectorShortcut,
8038
+ isRunning: !!isRunning,
8039
+ isLatest: isLatestAssistantMessage
8040
+ });
8451
8041
  const { open: commentOpen, close: closeComment } = comment;
8452
8042
  (0, react.useEffect)(() => {
8453
8043
  if (!commentOpen) return;
@@ -8497,7 +8087,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
8497
8087
  ref: root,
8498
8088
  "data-copilotkit": true,
8499
8089
  "data-testid": "copilot-assistant-message",
8500
- className: require_MarkdownSurfaces.cn("copilotKitMessage copilotKitAssistantMessage", className),
8090
+ className: (0, _copilotkit_core.ɵcn)("copilotKitMessage copilotKitAssistantMessage", className),
8501
8091
  ...props,
8502
8092
  "data-message-id": message.id,
8503
8093
  children: [
@@ -8532,7 +8122,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
8532
8122
  };
8533
8123
  _CopilotChatAssistantMessage.Toolbar = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8534
8124
  "data-testid": "copilot-assistant-toolbar",
8535
- className: require_MarkdownSurfaces.cn("cpk-assistant-message-toolbar", className),
8125
+ className: (0, _copilotkit_core.ɵcn)("cpk-assistant-message-toolbar", className),
8536
8126
  ...props
8537
8127
  });
8538
8128
  const ToolbarButton = _CopilotChatAssistantMessage.ToolbarButton = ({ title, tooltip, tooltipClassName, children, ...props }) => {
@@ -8560,24 +8150,10 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
8560
8150
  };
8561
8151
  _CopilotChatAssistantMessage.CopyButton = ({ className, title, onClick, ...props }) => {
8562
8152
  const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
8563
- const [copied, setCopied] = (0, react.useState)(false);
8564
- const timerRef = (0, react.useRef)(null);
8565
- (0, react.useEffect)(() => {
8566
- return () => {
8567
- if (timerRef.current !== null) clearTimeout(timerRef.current);
8568
- };
8569
- }, []);
8153
+ const { copied, markCopied } = useCopyFeedback();
8570
8154
  const handleClick = async (event) => {
8571
- let success = false;
8572
- if (onClick) success = await Promise.resolve(onClick(event)) === true;
8573
- if (success) {
8574
- setCopied(true);
8575
- if (timerRef.current !== null) clearTimeout(timerRef.current);
8576
- timerRef.current = setTimeout(() => {
8577
- timerRef.current = null;
8578
- setCopied(false);
8579
- }, 2e3);
8580
- }
8155
+ if (!onClick) return;
8156
+ if (await Promise.resolve(onClick(event)) === true) markCopied();
8581
8157
  };
8582
8158
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
8583
8159
  "data-testid": "copilot-copy-button",
@@ -8628,7 +8204,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
8628
8204
  const changed = value.trim() !== savedComment;
8629
8205
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
8630
8206
  "data-testid": "copilot-feedback-comment",
8631
- className: require_MarkdownSurfaces.cn("cpk-assistant-message-feedback-comment", className),
8207
+ className: (0, _copilotkit_core.ɵcn)("cpk-assistant-message-feedback-comment", className),
8632
8208
  onSubmit: (event) => {
8633
8209
  event.preventDefault();
8634
8210
  onSubmit();
@@ -8644,7 +8220,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
8644
8220
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8645
8221
  ref: inputRef,
8646
8222
  value,
8647
- maxLength: MESSAGE_FEEDBACK_MAX_COMMENT_LENGTH,
8223
+ maxLength: _copilotkit_core.ɵMESSAGE_FEEDBACK_MAX_COMMENT_LENGTH,
8648
8224
  onChange: (event) => onChange(event.target.value),
8649
8225
  placeholder: labels.assistantMessageFeedbackCommentPlaceholder,
8650
8226
  "aria-label": labels.assistantMessageFeedbackCommentPlaceholder,
@@ -8787,14 +8363,14 @@ const ImageAttachment = (0, react.memo)(function ImageAttachment({ src, classNam
8787
8363
  const [error, setError] = (0, react.useState)(false);
8788
8364
  const { thumbnailRef, vtName, open, openLightbox, closeLightbox } = useLightbox();
8789
8365
  if (error) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8790
- className: require_MarkdownSurfaces.cn("cpk-attachment-renderer cpk-attachment-renderer-image-error", className),
8366
+ className: (0, _copilotkit_core.ɵcn)("cpk-attachment-renderer cpk-attachment-renderer-image-error", className),
8791
8367
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: labels.attachmentImageLoadErrorText })
8792
8368
  });
8793
8369
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
8794
8370
  ref: thumbnailRef,
8795
8371
  src,
8796
8372
  alt: labels.attachmentImageAltText,
8797
- className: require_MarkdownSurfaces.cn("cpk-attachment-renderer cpk-attachment-renderer-image", className),
8373
+ className: (0, _copilotkit_core.ɵcn)("cpk-attachment-renderer cpk-attachment-renderer-image", className),
8798
8374
  onClick: openLightbox,
8799
8375
  onError: () => setError(true)
8800
8376
  }), open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Lightbox, {
@@ -8809,7 +8385,7 @@ const ImageAttachment = (0, react.memo)(function ImageAttachment({ src, classNam
8809
8385
  });
8810
8386
  const AudioAttachment = (0, react.memo)(function AudioAttachment({ src, filename, className }) {
8811
8387
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8812
- className: require_MarkdownSurfaces.cn("cpk-attachment-renderer cpk-attachment-renderer-audio", className),
8388
+ className: (0, _copilotkit_core.ɵcn)("cpk-attachment-renderer cpk-attachment-renderer-audio", className),
8813
8389
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("audio", {
8814
8390
  src,
8815
8391
  controls: true,
@@ -8826,7 +8402,7 @@ const VideoAttachment = (0, react.memo)(function VideoAttachment({ src, classNam
8826
8402
  src,
8827
8403
  controls: true,
8828
8404
  preload: "metadata",
8829
- className: require_MarkdownSurfaces.cn("cpk-attachment-renderer cpk-attachment-renderer-video", className)
8405
+ className: (0, _copilotkit_core.ɵcn)("cpk-attachment-renderer cpk-attachment-renderer-video", className)
8830
8406
  });
8831
8407
  });
8832
8408
  const DocumentAttachment = (0, react.memo)(function DocumentAttachment({ src, source, filename, className }) {
@@ -8838,7 +8414,7 @@ const DocumentAttachment = (0, react.memo)(function DocumentAttachment({ src, so
8838
8414
  target: "_blank",
8839
8415
  rel: "noopener noreferrer",
8840
8416
  "aria-label": label,
8841
- className: require_MarkdownSurfaces.cn("cpk-attachment-renderer cpk-attachment-renderer-document", className),
8417
+ className: (0, _copilotkit_core.ɵcn)("cpk-attachment-renderer cpk-attachment-renderer-document", className),
8842
8418
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8843
8419
  className: "cpk-attachment-renderer-document-icon",
8844
8420
  children: (0, _copilotkit_shared.getDocumentIcon)(source.mimeType ?? "")
@@ -8875,25 +8451,9 @@ const CopilotChatAttachmentRenderer = ({ type, source, filename, className }) =>
8875
8451
 
8876
8452
  //#endregion
8877
8453
  //#region src/components/chat/CopilotChatUserMessage.tsx
8878
- function flattenUserMessageContent(content) {
8879
- if (!content) return "";
8880
- if (typeof content === "string") return content;
8881
- return content.map((part) => {
8882
- if (part && typeof part === "object" && "type" in part && part.type === "text" && typeof part.text === "string") return part.text;
8883
- return "";
8884
- }).filter((text) => text.length > 0).join("\n");
8885
- }
8886
- function getMediaParts(content) {
8887
- if (!content || typeof content === "string") return [];
8888
- return content.filter((part) => part.type === "image" || part.type === "audio" || part.type === "video" || part.type === "document");
8889
- }
8890
- function getFilename(part) {
8891
- const meta = part.metadata;
8892
- if (meta != null && typeof meta === "object" && "filename" in meta && typeof meta.filename === "string") return meta.filename;
8893
- }
8894
8454
  function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfBranches, onSwitchToBranch, additionalToolbarItems, messageRenderer, toolbar, copyButton, editButton, branchNavigation, children, className, ...props }) {
8895
- const flattenedContent = (0, react.useMemo)(() => flattenUserMessageContent(message.content), [message.content]);
8896
- const mediaParts = (0, react.useMemo)(() => getMediaParts(message.content), [message.content]);
8455
+ const flattenedContent = (0, react.useMemo)(() => (0, _copilotkit_core.ɵflattenUserMessageContent)(message.content), [message.content]);
8456
+ const mediaParts = (0, react.useMemo)(() => (0, _copilotkit_core.ɵgetUserMessageMediaParts)(message.content), [message.content]);
8897
8457
  const BoundMessageRenderer = require_MarkdownSurfaces.renderSlot(messageRenderer, CopilotChatUserMessage.MessageRenderer, { content: flattenedContent });
8898
8458
  const BoundCopyButton = require_MarkdownSurfaces.renderSlot(copyButton, CopilotChatUserMessage.CopyButton, { onClick: async () => {
8899
8459
  if (flattenedContent) return await (0, _copilotkit_shared.copyToClipboard)(flattenedContent);
@@ -8906,7 +8466,11 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
8906
8466
  onSwitchToBranch,
8907
8467
  message
8908
8468
  });
8909
- const showBranchNavigation = numberOfBranches && numberOfBranches > 1 && onSwitchToBranch;
8469
+ const { show: showBranchNavigation } = (0, _copilotkit_core.ɵgetBranchNavState)({
8470
+ branchIndex: branchIndex ?? 0,
8471
+ numberOfBranches: numberOfBranches ?? 1,
8472
+ canSwitch: onSwitchToBranch !== void 0
8473
+ });
8910
8474
  const BoundToolbar = require_MarkdownSurfaces.renderSlot(toolbar, CopilotChatUserMessage.Toolbar, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8911
8475
  className: "cpk-user-message-toolbar-items",
8912
8476
  children: [
@@ -8934,7 +8498,7 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
8934
8498
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8935
8499
  "data-copilotkit": true,
8936
8500
  "data-testid": "copilot-user-message",
8937
- className: require_MarkdownSurfaces.cn("copilotKitMessage copilotKitUserMessage cpk-user-message", className),
8501
+ className: (0, _copilotkit_core.ɵcn)("copilotKitMessage copilotKitUserMessage cpk-user-message", className),
8938
8502
  "data-message-id": message.id,
8939
8503
  ...props,
8940
8504
  children: [
@@ -8943,7 +8507,7 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
8943
8507
  children: mediaParts.map((part, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChatAttachmentRenderer, {
8944
8508
  type: part.type,
8945
8509
  source: part.source,
8946
- filename: getFilename(part)
8510
+ filename: (0, _copilotkit_core.ɵgetUserMessageMediaFilename)(part)
8947
8511
  }, index))
8948
8512
  }),
8949
8513
  BoundMessageRenderer,
@@ -8953,17 +8517,17 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
8953
8517
  }
8954
8518
  (function(_CopilotChatUserMessage) {
8955
8519
  _CopilotChatUserMessage.Container = ({ children, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8956
- className: require_MarkdownSurfaces.cn("cpk-user-message-container", className),
8520
+ className: (0, _copilotkit_core.ɵcn)("cpk-user-message-container", className),
8957
8521
  ...props,
8958
8522
  children
8959
8523
  });
8960
8524
  _CopilotChatUserMessage.MessageRenderer = ({ content, className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8961
- className: require_MarkdownSurfaces.cn("cpk-user-message-bubble", className),
8525
+ className: (0, _copilotkit_core.ɵcn)("cpk-user-message-bubble", className),
8962
8526
  children: content
8963
8527
  });
8964
8528
  _CopilotChatUserMessage.Toolbar = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8965
8529
  "data-testid": "copilot-user-toolbar",
8966
- className: require_MarkdownSurfaces.cn("cpk-user-message-toolbar", className),
8530
+ className: (0, _copilotkit_core.ɵcn)("cpk-user-message-toolbar", className),
8967
8531
  ...props
8968
8532
  });
8969
8533
  const ToolbarButton = _CopilotChatUserMessage.ToolbarButton = ({ title, children, className, ...props }) => {
@@ -8984,14 +8548,10 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
8984
8548
  };
8985
8549
  _CopilotChatUserMessage.CopyButton = ({ className, title, onClick, ...props }) => {
8986
8550
  const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
8987
- const [copied, setCopied] = (0, react.useState)(false);
8551
+ const { copied, markCopied } = useCopyFeedback();
8988
8552
  const handleClick = async (event) => {
8989
- let success = false;
8990
- if (onClick) success = await Promise.resolve(onClick(event)) === true;
8991
- if (success) {
8992
- setCopied(true);
8993
- setTimeout(() => setCopied(false), 2e3);
8994
- }
8553
+ if (!onClick) return;
8554
+ if (await Promise.resolve(onClick(event)) === true) markCopied();
8995
8555
  };
8996
8556
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
8997
8557
  "data-testid": "copilot-user-copy-button",
@@ -9025,12 +8585,15 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
9025
8585
  };
9026
8586
  _CopilotChatUserMessage.BranchNavigation = ({ className, currentBranch = 0, numberOfBranches = 1, onSwitchToBranch, message, ...props }) => {
9027
8587
  const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
9028
- if (!numberOfBranches || numberOfBranches <= 1 || !onSwitchToBranch) return null;
9029
- const canGoPrev = currentBranch > 0;
9030
- const canGoNext = currentBranch < numberOfBranches - 1;
8588
+ const { show, canGoPrev, canGoNext } = (0, _copilotkit_core.ɵgetBranchNavState)({
8589
+ branchIndex: currentBranch,
8590
+ numberOfBranches,
8591
+ canSwitch: onSwitchToBranch !== void 0
8592
+ });
8593
+ if (!show) return null;
9031
8594
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9032
8595
  "data-testid": "copilot-branch-navigation",
9033
- className: require_MarkdownSurfaces.cn("cpk-user-message-branch-navigation", className),
8596
+ className: (0, _copilotkit_core.ɵcn)("cpk-user-message-branch-navigation", className),
9034
8597
  ...props,
9035
8598
  children: [
9036
8599
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
@@ -9089,27 +8652,6 @@ var CopilotChatUserMessage_default = CopilotChatUserMessage;
9089
8652
  //#endregion
9090
8653
  //#region src/components/chat/CopilotChatReasoningMessage.tsx
9091
8654
  /**
9092
- * The reasoning time as label text, such as "4 seconds" or "1m 5s".
9093
- *
9094
- * @param seconds - The elapsed time in seconds. It may have a fraction.
9095
- * @param labels - The chat labels that hold the duration texts.
9096
- */
9097
- function formatDuration(seconds, labels) {
9098
- const duration = (0, _copilotkit_core.ɵformatReasoningDuration)(seconds);
9099
- switch (duration.unit) {
9100
- case "fewSeconds": return labels.reasoningMessageDurationFewSeconds;
9101
- case "seconds": return (0, _copilotkit_core.ɵformatLabel)(labels.reasoningMessageDurationSeconds, { count: duration.seconds });
9102
- case "minutes": return (0, _copilotkit_core.ɵformatCountLabel)(duration.minutes, {
9103
- one: labels.reasoningMessageDurationMinutesOne,
9104
- other: labels.reasoningMessageDurationMinutesOther
9105
- });
9106
- case "minutesSeconds": return (0, _copilotkit_core.ɵformatLabel)(labels.reasoningMessageDurationMinutesSeconds, {
9107
- minutes: duration.minutes,
9108
- seconds: duration.seconds
9109
- });
9110
- }
9111
- }
9112
- /**
9113
8655
  * A reasoning message as a collapsible block. While the model reasons it is
9114
8656
  * open and the header shows `labels.reasoningMessageThinkingLabel`; when
9115
8657
  * streaming ends it collapses and the header reads
@@ -9147,7 +8689,7 @@ function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: i
9147
8689
  userToggledRef.current = true;
9148
8690
  setIsOpen((prev) => !prev);
9149
8691
  } : void 0;
9150
- const label = isStreaming ? labels.reasoningMessageThinkingLabel : (0, _copilotkit_core.ɵformatLabel)(labels.reasoningMessageThoughtForLabel, { duration: formatDuration(elapsed, labels) });
8692
+ const label = isStreaming ? labels.reasoningMessageThinkingLabel : (0, _copilotkit_core.ɵformatLabel)(labels.reasoningMessageThoughtForLabel, { duration: (0, _copilotkit_core.ɵformatReasoningDurationLabel)(elapsed, labels) });
9151
8693
  const boundHeader = require_MarkdownSurfaces.renderSlot(header, CopilotChatReasoningMessage.Header, {
9152
8694
  isOpen,
9153
8695
  label,
@@ -9178,7 +8720,7 @@ function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: i
9178
8720
  })
9179
8721
  });
9180
8722
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9181
- className: require_MarkdownSurfaces.cn("cpk-reasoning-message", className),
8723
+ className: (0, _copilotkit_core.ɵcn)("cpk-reasoning-message", className),
9182
8724
  "data-message-id": message.id,
9183
8725
  ...props,
9184
8726
  children: [boundHeader, boundToggle]
@@ -9189,7 +8731,7 @@ function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: i
9189
8731
  const isExpandable = !!hasContent;
9190
8732
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
9191
8733
  type: "button",
9192
- className: require_MarkdownSurfaces.cn("cpk-reasoning-message-header", isExpandable && "cpk-reasoning-message-header-expandable", className),
8734
+ className: (0, _copilotkit_core.ɵcn)("cpk-reasoning-message-header", isExpandable && "cpk-reasoning-message-header-expandable", className),
9193
8735
  "aria-expanded": isExpandable ? isOpen : void 0,
9194
8736
  ...headerProps,
9195
8737
  children: [
@@ -9204,7 +8746,7 @@ function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: i
9204
8746
  headerChildren,
9205
8747
  isExpandable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
9206
8748
  name: "ChevronRight",
9207
- className: require_MarkdownSurfaces.cn("cpk-reasoning-message-chevron", isOpen && "cpk-reasoning-message-chevron-open")
8749
+ className: (0, _copilotkit_core.ɵcn)("cpk-reasoning-message-chevron", isOpen && "cpk-reasoning-message-chevron-open")
9208
8750
  })
9209
8751
  ]
9210
8752
  });
@@ -9212,7 +8754,7 @@ function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: i
9212
8754
  _CopilotChatReasoningMessage.Content = ({ isStreaming, hasContent, className, children: contentChildren, ...contentProps }) => {
9213
8755
  if (!hasContent && !isStreaming) return null;
9214
8756
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9215
- className: require_MarkdownSurfaces.cn("cpk-reasoning-message-content", className),
8757
+ className: (0, _copilotkit_core.ɵcn)("cpk-reasoning-message-content", className),
9216
8758
  ...contentProps,
9217
8759
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9218
8760
  className: "cpk-reasoning-message-text",
@@ -9228,7 +8770,7 @@ function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: i
9228
8770
  };
9229
8771
  _CopilotChatReasoningMessage.Toggle = ({ isOpen, className, children: toggleChildren, ...toggleProps }) => {
9230
8772
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9231
- className: require_MarkdownSurfaces.cn("cpk-reasoning-message-toggle", className),
8773
+ className: (0, _copilotkit_core.ɵcn)("cpk-reasoning-message-toggle", className),
9232
8774
  style: { gridTemplateRows: isOpen ? "1fr" : "0fr" },
9233
8775
  ...toggleProps,
9234
8776
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -9282,7 +8824,7 @@ const DefaultContainer = react.default.forwardRef(function DefaultContainer({ cl
9282
8824
  ref,
9283
8825
  "data-copilotkit": true,
9284
8826
  "data-testid": "copilot-suggestions",
9285
- className: require_MarkdownSurfaces.cn("cpk-suggestion-view", className),
8827
+ className: (0, _copilotkit_core.ɵcn)("cpk-suggestion-view", className),
9286
8828
  ...props
9287
8829
  });
9288
8830
  });
@@ -9396,49 +8938,41 @@ function useNow(active) {
9396
8938
  */
9397
8939
  function CopilotChatWorkSummary({ isWorking, isOpen, calls, elapsedMs, workingSince, className, ...props }) {
9398
8940
  const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
9399
- const now = useNow(isWorking);
9400
- const failed = (0, _copilotkit_core.ɵcountFailedToolCalls)(calls);
9401
- const toolCount = (0, _copilotkit_core.ɵformatCountLabel)(calls.length, {
9402
- one: labels.toolCallToolCountOne,
9403
- other: labels.toolCallToolCountOther
8941
+ const text = (0, _copilotkit_core.ɵgetWorkSummaryText)({
8942
+ isWorking,
8943
+ calls,
8944
+ elapsedMs,
8945
+ workingSince,
8946
+ now: useNow(isWorking),
8947
+ labels
9404
8948
  });
9405
- const liveMs = elapsedMs !== void 0 && workingSince !== void 0 ? elapsedMs + Math.max(0, now - workingSince) : void 0;
9406
- const duration = elapsedMs !== void 0 ? (0, _copilotkit_core.ɵformatWorkDuration)(Math.max(1e3, elapsedMs)) : void 0;
9407
8949
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
9408
8950
  type: "button",
9409
8951
  "data-copilotkit": true,
9410
8952
  "data-testid": "copilot-work-summary",
9411
8953
  "data-state": isWorking ? "working" : "done",
9412
8954
  "aria-expanded": isOpen,
9413
- className: require_MarkdownSurfaces.cn("cpk-work-summary", className),
8955
+ className: (0, _copilotkit_core.ɵcn)("cpk-work-summary", className),
9414
8956
  ...props,
9415
- children: [isWorking ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
9416
- className: "cpk-work-summary-label cpk-shimmer",
9417
- children: labels.workSummaryWorkingLabel
9418
- }), liveMs !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
9419
- className: "cpk-work-summary-detail cpk-work-summary-timer",
9420
- children: (0, _copilotkit_core.ɵformatWorkDuration)(liveMs)
9421
- })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
8957
+ children: [
9422
8958
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
9423
- className: "cpk-work-summary-label",
9424
- children: duration ? (0, _copilotkit_core.ɵformatLabel)(labels.workSummaryWorkedForLabel, { duration }) : (0, _copilotkit_core.ɵformatCountLabel)(calls.length, {
9425
- one: labels.toolCallUsedToolsOne,
9426
- other: labels.toolCallUsedToolsOther
9427
- })
8959
+ className: (0, _copilotkit_core.ɵcn)("cpk-work-summary-label", isWorking && "cpk-shimmer"),
8960
+ children: text.label
9428
8961
  }),
9429
- duration && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
9430
- className: "cpk-work-summary-detail",
9431
- children: toolCount
8962
+ text.detail !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8963
+ className: (0, _copilotkit_core.ɵcn)("cpk-work-summary-detail", isWorking && "cpk-work-summary-timer"),
8964
+ children: text.detail
9432
8965
  }),
9433
- failed > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8966
+ text.failed !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
9434
8967
  className: "cpk-work-summary-failed",
9435
- children: (0, _copilotkit_core.ɵformatLabel)(labels.toolCallFailedCountLabel, { count: failed })
8968
+ children: text.failed
8969
+ }),
8970
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
8971
+ name: "ChevronRight",
8972
+ "aria-hidden": "true",
8973
+ className: (0, _copilotkit_core.ɵcn)("cpk-work-summary-chevron", isOpen && "cpk-work-summary-chevron-open")
9436
8974
  })
9437
- ] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
9438
- name: "ChevronRight",
9439
- "aria-hidden": "true",
9440
- className: require_MarkdownSurfaces.cn("cpk-work-summary-chevron", isOpen && "cpk-work-summary-chevron-open")
9441
- })]
8975
+ ]
9442
8976
  });
9443
8977
  }
9444
8978
 
@@ -9479,7 +9013,7 @@ function CopilotChatWorkSummary({ isWorking, isOpen, calls, elapsedMs, workingSi
9479
9013
  */
9480
9014
  function IntelligenceIndicatorView({ message, status, label, className, ...rest }) {
9481
9015
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
9482
- className: require_MarkdownSurfaces.cn("cpk-intelligence-indicator", className),
9016
+ className: (0, _copilotkit_core.ɵcn)("cpk-intelligence-indicator", className),
9483
9017
  role: "status",
9484
9018
  "aria-live": "polite",
9485
9019
  "data-testid": `cpk-intelligence-indicator-${message.id}`,
@@ -10445,7 +9979,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
10445
9979
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10446
9980
  "data-copilotkit": true,
10447
9981
  "data-testid": "copilot-message-list",
10448
- className: require_MarkdownSurfaces.cn("copilotKitMessages cpk-message-view", className),
9982
+ className: (0, _copilotkit_core.ɵcn)("copilotKitMessages cpk-message-view", className),
10449
9983
  ...props,
10450
9984
  children: [
10451
9985
  shouldVirtualize ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -10485,7 +10019,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
10485
10019
  CopilotChatMessageView.Cursor = function Cursor({ className, ...props }) {
10486
10020
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
10487
10021
  "data-testid": "copilot-loading-cursor",
10488
- className: require_MarkdownSurfaces.cn("cpk-message-view-cursor", className),
10022
+ className: (0, _copilotkit_core.ɵcn)("cpk-message-view-cursor", className),
10489
10023
  ...props
10490
10024
  });
10491
10025
  };
@@ -10501,10 +10035,10 @@ const CopilotChatAttachmentQueue = ({ attachments, onRemoveAttachment, className
10501
10035
  if (attachments.length === 0) return null;
10502
10036
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
10503
10037
  "data-testid": "copilot-attachment-queue",
10504
- className: require_MarkdownSurfaces.cn("cpk-attachment-queue", className),
10038
+ className: (0, _copilotkit_core.ɵcn)("cpk-attachment-queue", className),
10505
10039
  children: attachments.map((attachment) => {
10506
10040
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10507
- className: require_MarkdownSurfaces.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"),
10041
+ 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"),
10508
10042
  children: [
10509
10043
  attachment.status === "uploading" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UploadingOverlay, {}),
10510
10044
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AttachmentPreview, { attachment }),
@@ -10721,7 +10255,7 @@ function DocumentPreview({ attachment }) {
10721
10255
  const previewable = canPreviewInBrowser(mimeType);
10722
10256
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10723
10257
  ref: thumbnailRef,
10724
- className: require_MarkdownSurfaces.cn("cpk-attachment-queue-document", previewable && "cpk-attachment-queue-document-previewable"),
10258
+ className: (0, _copilotkit_core.ɵcn)("cpk-attachment-queue-document", previewable && "cpk-attachment-queue-document-previewable"),
10725
10259
  onClick: previewable ? openLightbox : void 0,
10726
10260
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
10727
10261
  className: "cpk-attachment-queue-document-icon",
@@ -10754,53 +10288,11 @@ function DocumentPreview({ attachment }) {
10754
10288
  * @returns KeyboardState object with keyboard information
10755
10289
  */
10756
10290
  function useKeyboardHeight() {
10757
- const [keyboardState, setKeyboardState] = (0, react.useState)({
10758
- isKeyboardOpen: false,
10759
- keyboardHeight: 0,
10760
- availableHeight: typeof window !== "undefined" ? window.innerHeight : 0,
10761
- viewportHeight: typeof window !== "undefined" ? window.innerHeight : 0
10762
- });
10763
- (0, react.useEffect)(() => {
10764
- if (typeof window === "undefined") return;
10765
- const visualViewport = window.visualViewport;
10766
- if (!visualViewport) return;
10767
- const updateKeyboardState = () => {
10768
- const layoutHeight = window.innerHeight;
10769
- const visualHeight = visualViewport.height;
10770
- const keyboardHeight = Math.max(0, layoutHeight - visualHeight);
10771
- setKeyboardState({
10772
- isKeyboardOpen: keyboardHeight > 150,
10773
- keyboardHeight,
10774
- availableHeight: visualHeight,
10775
- viewportHeight: layoutHeight
10776
- });
10777
- };
10778
- updateKeyboardState();
10779
- visualViewport.addEventListener("resize", updateKeyboardState);
10780
- visualViewport.addEventListener("scroll", updateKeyboardState);
10781
- return () => {
10782
- visualViewport.removeEventListener("resize", updateKeyboardState);
10783
- visualViewport.removeEventListener("scroll", updateKeyboardState);
10784
- };
10785
- }, []);
10291
+ const [keyboardState, setKeyboardState] = (0, react.useState)(_copilotkit_core.ɵinitialKeyboardState);
10292
+ (0, react.useEffect)(() => (0, _copilotkit_core.ɵwatchKeyboardState)(setKeyboardState), []);
10786
10293
  return keyboardState;
10787
10294
  }
10788
10295
 
10789
- //#endregion
10790
- //#region src/components/chat/normalize-auto-scroll.ts
10791
- const VALID = [
10792
- "pin-to-bottom",
10793
- "pin-to-send",
10794
- "none"
10795
- ];
10796
- function normalizeAutoScroll(value) {
10797
- if (value === void 0) return "pin-to-bottom";
10798
- if (value === true) return "pin-to-bottom";
10799
- if (value === false) return "none";
10800
- if (VALID.includes(value)) return value;
10801
- return "pin-to-bottom";
10802
- }
10803
-
10804
10296
  //#endregion
10805
10297
  //#region src/components/chat/last-user-message-context.ts
10806
10298
  const LastUserMessageContext = react.default.createContext({
@@ -10810,6 +10302,11 @@ const LastUserMessageContext = react.default.createContext({
10810
10302
 
10811
10303
  //#endregion
10812
10304
  //#region src/hooks/use-pin-to-send.ts
10305
+ /**
10306
+ * Pins the latest sent user message near the top of the chat while the reply
10307
+ * streams below it. Core's `ɵpinMessageToTop` does the measuring and
10308
+ * scrolling; this hook runs it once per send.
10309
+ */
10813
10310
  function usePinToSend({ scrollRef, contentRef, spacerRef, topOffset = 16 }) {
10814
10311
  const { id, sendNonce } = (0, react.useContext)(LastUserMessageContext);
10815
10312
  const lastNonceRef = (0, react.useRef)(-1);
@@ -10822,35 +10319,15 @@ function usePinToSend({ scrollRef, contentRef, spacerRef, topOffset = 16 }) {
10822
10319
  const contentEl = contentRef.current;
10823
10320
  const spacerEl = spacerRef.current;
10824
10321
  if (!scrollEl || !contentEl || !spacerEl) return;
10825
- const escaped = typeof CSS !== "undefined" && CSS.escape ? CSS.escape(id) : id.replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "\\$&");
10826
- const targetEl = contentEl.querySelector(`[data-message-id="${escaped}"]`);
10827
- if (!targetEl) return;
10828
- const viewportHeight = scrollEl.clientHeight;
10829
- const userMessageHeight = targetEl.getBoundingClientRect().height;
10830
- const paddingTop = parseFloat(getComputedStyle(targetEl).paddingTop) || 0;
10831
- const bubbleHeight = Math.max(0, userMessageHeight - paddingTop);
10832
- const spacerHeight = Math.max(0, viewportHeight - bubbleHeight - topOffset);
10833
- spacerEl.style.height = `${spacerHeight}px`;
10834
- let pinned = false;
10835
- const raf = requestAnimationFrame(() => {
10836
- pinned = true;
10837
- const targetTop = computeOffsetTop(targetEl, scrollEl) + paddingTop - topOffset;
10838
- scrollEl.scrollTo({
10839
- top: Math.max(0, targetTop),
10840
- behavior: "smooth"
10841
- });
10842
- });
10843
- const ro = new ResizeObserver(() => {
10844
- if (!contentEl || !spacerEl || !scrollEl) return;
10845
- const consumedBelow = contentEl.getBoundingClientRect().height - computeOffsetTop(targetEl, contentEl) - userMessageHeight;
10846
- const remaining = Math.max(0, spacerHeight - consumedBelow);
10847
- spacerEl.style.height = `${remaining}px`;
10322
+ const unpin = (0, _copilotkit_core.ɵpinMessageToTop)({
10323
+ scrollEl,
10324
+ contentEl,
10325
+ spacerEl,
10326
+ messageId: id,
10327
+ topOffset
10848
10328
  });
10849
- ro.observe(contentEl);
10850
10329
  return () => {
10851
- cancelAnimationFrame(raf);
10852
- ro.disconnect();
10853
- if (!pinned) lastNonceRef.current = previousNonce;
10330
+ if (!unpin()) lastNonceRef.current = previousNonce;
10854
10331
  };
10855
10332
  }, [
10856
10333
  id,
@@ -10861,11 +10338,6 @@ function usePinToSend({ scrollRef, contentRef, spacerRef, topOffset = 16 }) {
10861
10338
  topOffset
10862
10339
  ]);
10863
10340
  }
10864
- function computeOffsetTop(el, stopAt) {
10865
- const elRect = el.getBoundingClientRect();
10866
- const stopRect = stopAt.getBoundingClientRect();
10867
- return elRect.top - stopRect.top + stopAt.scrollTop;
10868
- }
10869
10341
 
10870
10342
  //#endregion
10871
10343
  //#region src/components/chat/CopilotChatView.tsx
@@ -11020,7 +10492,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
11020
10492
  onDragOver,
11021
10493
  onDragLeave,
11022
10494
  onDrop,
11023
- className: require_MarkdownSurfaces.cn("copilotKitChat cpk-chat-view", className),
10495
+ className: (0, _copilotkit_core.ɵcn)("copilotKitChat cpk-chat-view", className),
11024
10496
  ...props,
11025
10497
  children: [dragOver && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropOverlay, {}), BoundWelcomeScreen]
11026
10498
  });
@@ -11044,7 +10516,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
11044
10516
  onDragOver,
11045
10517
  onDragLeave,
11046
10518
  onDrop,
11047
- className: require_MarkdownSurfaces.cn("copilotKitChat cpk-chat-view", className),
10519
+ className: (0, _copilotkit_core.ɵcn)("copilotKitChat cpk-chat-view", className),
11048
10520
  ...props,
11049
10521
  children: [
11050
10522
  dragOver && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropOverlay, {}),
@@ -11201,7 +10673,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
11201
10673
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollElementContext.Provider, {
11202
10674
  value: nonAutoScrollEl,
11203
10675
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11204
- className: require_MarkdownSurfaces.cn("cpk-chat-view-scroll-area", className),
10676
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-view-scroll-area", className),
11205
10677
  children: [
11206
10678
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11207
10679
  ref: nonAutoScrollRefCallback,
@@ -11232,7 +10704,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
11232
10704
  });
11233
10705
  };
11234
10706
  _CopilotChatView.ScrollView = ({ children, autoScroll = "pin-to-bottom", scrollThreadId, scrollToBottomButton, feather, inputContainerHeight = 0, isResizing = false, className, ...props }) => {
11235
- const mode = normalizeAutoScroll(autoScroll);
10707
+ const mode = (0, _copilotkit_core.ɵnormalizeAutoScroll)(autoScroll);
11236
10708
  const [hasMounted, setHasMounted] = (0, react.useState)(false);
11237
10709
  const scrollRef = (0, react.useRef)(null);
11238
10710
  const contentRef = (0, react.useRef)(null);
@@ -11283,7 +10755,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
11283
10755
  value: nonAutoScrollEl,
11284
10756
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11285
10757
  ref: nonAutoScrollRefCallback,
11286
- className: require_MarkdownSurfaces.cn("cpk-chat-view-scroll-area cpk-chat-view-scroll-viewport", className),
10758
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-view-scroll-area cpk-chat-view-scroll-viewport", className),
11287
10759
  ...props,
11288
10760
  children: [
11289
10761
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -11317,7 +10789,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
11317
10789
  children
11318
10790
  });
11319
10791
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(use_stick_to_bottom.StickToBottom, {
11320
- className: require_MarkdownSurfaces.cn("cpk-chat-view-scroll-view", className),
10792
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-view-scroll-view", className),
11321
10793
  resize: "smooth",
11322
10794
  initial: "smooth",
11323
10795
  ...props,
@@ -11337,7 +10809,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
11337
10809
  "data-testid": "copilot-scroll-to-bottom",
11338
10810
  variant: "outline",
11339
10811
  size: "sm",
11340
- className: require_MarkdownSurfaces.cn("cpk-chat-view-scroll-to-bottom-button", className),
10812
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-view-scroll-to-bottom-button", className),
11341
10813
  "aria-label": labels.chatScrollToBottomLabel,
11342
10814
  ...props,
11343
10815
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
@@ -11355,7 +10827,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
11355
10827
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11356
10828
  "data-testid": "copilot-connecting-indicator",
11357
10829
  role: "status",
11358
- className: require_MarkdownSurfaces.cn("cpk-chat-view-connecting-indicator", className),
10830
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-view-connecting-indicator", className),
11359
10831
  ...props,
11360
10832
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
11361
10833
  name: "Loader2",
@@ -11369,7 +10841,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
11369
10841
  _CopilotChatView.WelcomeMessage = ({ className, ...props }) => {
11370
10842
  const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
11371
10843
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
11372
- className: require_MarkdownSurfaces.cn("cpk-chat-view-welcome-message", className),
10844
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-view-welcome-message", className),
11373
10845
  ...props,
11374
10846
  children: labels.welcomeMessageText
11375
10847
  });
@@ -11389,7 +10861,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
11389
10861
  });
11390
10862
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
11391
10863
  "data-testid": "copilot-welcome-screen",
11392
- className: require_MarkdownSurfaces.cn("cpk-chat-view-welcome-screen", className),
10864
+ className: (0, _copilotkit_core.ɵcn)("cpk-chat-view-welcome-screen", className),
11393
10865
  ...props,
11394
10866
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11395
10867
  className: "cpk-chat-view-welcome-screen-content",
@@ -12275,7 +11747,7 @@ const CopilotChatToggleButton = react.default.forwardRef(function CopilotChatTog
12275
11747
  "data-testid": "copilot-chat-toggle",
12276
11748
  "data-slot": "chat-toggle-button",
12277
11749
  "data-state": isOpen ? "open" : "closed",
12278
- className: require_MarkdownSurfaces.cn("copilotKitButton cpk-chat-toggle-button", className),
11750
+ className: (0, _copilotkit_core.ɵcn)("copilotKitButton cpk-chat-toggle-button", className),
12279
11751
  "aria-label": isOpen ? labels.chatToggleCloseLabel : labels.chatToggleOpenLabel,
12280
11752
  "aria-pressed": isOpen,
12281
11753
  disabled,
@@ -12331,14 +11803,7 @@ function useModalOpenControl() {
12331
11803
  */
12332
11804
  function useIsMobileViewport() {
12333
11805
  const [isMobile, setIsMobile] = (0, react.useState)(false);
12334
- (0, react.useEffect)(() => {
12335
- if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
12336
- const mql = window.matchMedia("(max-width: 767px)");
12337
- const update = () => setIsMobile(mql.matches);
12338
- update();
12339
- mql.addEventListener("change", update);
12340
- return () => mql.removeEventListener("change", update);
12341
- }, []);
11806
+ (0, react.useEffect)(() => (0, _copilotkit_core.ɵwatchMobileViewport)(setIsMobile), []);
12342
11807
  return isMobile;
12343
11808
  }
12344
11809
  function CopilotModalHeader({ title, titleContent, closeButton, drawerLauncher, children, className, ...rest }) {
@@ -12369,7 +11834,7 @@ function CopilotModalHeader({ title, titleContent, closeButton, drawerLauncher,
12369
11834
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
12370
11835
  "data-testid": "copilot-modal-header",
12371
11836
  "data-slot": "copilot-modal-header",
12372
- className: require_MarkdownSurfaces.cn("copilotKitHeader cpk-modal-header", className),
11837
+ className: (0, _copilotkit_core.ɵcn)("copilotKitHeader cpk-modal-header", className),
12373
11838
  ...rest,
12374
11839
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12375
11840
  className: "cpk-modal-header-content",
@@ -12394,7 +11859,7 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
12394
11859
  (function(_CopilotModalHeader) {
12395
11860
  _CopilotModalHeader.Title = ({ children, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
12396
11861
  "data-testid": "copilot-header-title",
12397
- className: require_MarkdownSurfaces.cn("cpk-modal-header-title", className),
11862
+ className: (0, _copilotkit_core.ɵcn)("cpk-modal-header-title", className),
12398
11863
  ...props,
12399
11864
  children
12400
11865
  });
@@ -12403,7 +11868,7 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
12403
11868
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
12404
11869
  type: "button",
12405
11870
  "data-testid": "copilot-close-button",
12406
- className: require_MarkdownSurfaces.cn("cpk-modal-header-close-button", className),
11871
+ className: (0, _copilotkit_core.ɵcn)("cpk-modal-header-close-button", className),
12407
11872
  "aria-label": labels.modalHeaderCloseButtonLabel,
12408
11873
  ...props,
12409
11874
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
@@ -12418,7 +11883,7 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
12418
11883
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
12419
11884
  type: "button",
12420
11885
  "data-testid": "copilot-threads-drawer-launcher",
12421
- className: require_MarkdownSurfaces.cn("cpk-modal-header-drawer-launcher", className),
11886
+ className: (0, _copilotkit_core.ɵcn)("cpk-modal-header-drawer-launcher", className),
12422
11887
  "aria-label": labels.modalHeaderThreadsButtonLabel,
12423
11888
  ...props,
12424
11889
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
@@ -12520,7 +11985,7 @@ function CopilotSidebarViewInternal({ header, toggleButton, width, position = "r
12520
11985
  "data-testid": "copilot-sidebar",
12521
11986
  "data-copilot-sidebar": true,
12522
11987
  "data-position": position,
12523
- className: require_MarkdownSurfaces.cn("copilotKitSidebar copilotKitWindow cpk-sidebar-view", !isSidebarOpen && "cpk-sidebar-view-closed"),
11988
+ className: (0, _copilotkit_core.ɵcn)("copilotKitSidebar copilotKitWindow cpk-sidebar-view", !isSidebarOpen && "cpk-sidebar-view-closed"),
12524
11989
  style: {
12525
11990
  "--sidebar-width": widthToCss(sidebarWidth),
12526
11991
  paddingTop: "env(safe-area-inset-top)",
@@ -12555,7 +12020,7 @@ CopilotSidebarView.displayName = "CopilotSidebarView";
12555
12020
  })
12556
12021
  });
12557
12022
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12558
- className: require_MarkdownSurfaces.cn("cpk-sidebar-view-welcome-screen", className),
12023
+ className: (0, _copilotkit_core.ɵcn)("cpk-sidebar-view-welcome-screen", className),
12559
12024
  ...props,
12560
12025
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
12561
12026
  className: "cpk-sidebar-view-welcome-screen-message",
@@ -12689,14 +12154,14 @@ function CopilotPopupViewInternal({ header, toggleButton, width, height, clickOu
12689
12154
  "aria-label": labels.modalHeaderTitle,
12690
12155
  "data-testid": "copilot-popup",
12691
12156
  "data-copilot-popup": true,
12692
- className: require_MarkdownSurfaces.cn("copilotKitPopup copilotKitWindow cpk-popup-view-window", isPopupOpen && !isAnimatingOut && "cpk-popup-view-window-open"),
12157
+ className: (0, _copilotkit_core.ɵcn)("copilotKitPopup copilotKitWindow cpk-popup-view-window", isPopupOpen && !isAnimatingOut && "cpk-popup-view-window-open"),
12693
12158
  style: popupStyle,
12694
12159
  children: [headerElement, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
12695
12160
  className: "cpk-popup-view-chat",
12696
12161
  "data-popup-chat": true,
12697
12162
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChatView_default, {
12698
12163
  ...restProps,
12699
- className: require_MarkdownSurfaces.cn("cpk-popup-view-chat-view", className)
12164
+ className: (0, _copilotkit_core.ɵcn)("cpk-popup-view-chat-view", className)
12700
12165
  })
12701
12166
  })]
12702
12167
  })
@@ -12718,7 +12183,7 @@ CopilotPopupView.displayName = "CopilotPopupView";
12718
12183
  })
12719
12184
  });
12720
12185
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12721
- className: require_MarkdownSurfaces.cn("cpk-popup-view-welcome-screen", className),
12186
+ className: (0, _copilotkit_core.ɵcn)("cpk-popup-view-welcome-screen", className),
12722
12187
  ...props,
12723
12188
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
12724
12189
  className: "cpk-popup-view-welcome-screen-message",
@@ -14612,18 +14077,96 @@ Object.defineProperty(exports, 'ɵCOPILOTKIT_FEATURES', {
14612
14077
  return _copilotkit_core.ɵCOPILOTKIT_FEATURES;
14613
14078
  }
14614
14079
  });
14080
+ Object.defineProperty(exports, 'ɵCOPY_FEEDBACK_RESET_MS', {
14081
+ enumerable: true,
14082
+ get: function () {
14083
+ return _copilotkit_core.ɵCOPY_FEEDBACK_RESET_MS;
14084
+ }
14085
+ });
14086
+ Object.defineProperty(exports, 'ɵCopyFeedback', {
14087
+ enumerable: true,
14088
+ get: function () {
14089
+ return _copilotkit_core.ɵCopyFeedback;
14090
+ }
14091
+ });
14092
+ Object.defineProperty(exports, 'ɵFEEDBACK_COMMENT_CLOSE_DELAY_MS', {
14093
+ enumerable: true,
14094
+ get: function () {
14095
+ return _copilotkit_core.ɵFEEDBACK_COMMENT_CLOSE_DELAY_MS;
14096
+ }
14097
+ });
14098
+ Object.defineProperty(exports, 'ɵFeedbackCommentController', {
14099
+ enumerable: true,
14100
+ get: function () {
14101
+ return _copilotkit_core.ɵFeedbackCommentController;
14102
+ }
14103
+ });
14104
+ Object.defineProperty(exports, 'ɵHOVER_MENU_CLOSE_DELAY_MS', {
14105
+ enumerable: true,
14106
+ get: function () {
14107
+ return _copilotkit_core.ɵHOVER_MENU_CLOSE_DELAY_MS;
14108
+ }
14109
+ });
14110
+ Object.defineProperty(exports, 'ɵHoverMenuController', {
14111
+ enumerable: true,
14112
+ get: function () {
14113
+ return _copilotkit_core.ɵHoverMenuController;
14114
+ }
14115
+ });
14116
+ Object.defineProperty(exports, 'ɵINLINE_FEATURE_WARNING_STYLE', {
14117
+ enumerable: true,
14118
+ get: function () {
14119
+ return _copilotkit_core.ɵINLINE_FEATURE_WARNING_STYLE;
14120
+ }
14121
+ });
14615
14122
  Object.defineProperty(exports, 'ɵInterruptState', {
14616
14123
  enumerable: true,
14617
14124
  get: function () {
14618
14125
  return _copilotkit_core.ɵInterruptState;
14619
14126
  }
14620
14127
  });
14128
+ Object.defineProperty(exports, 'ɵKEYBOARD_OPEN_THRESHOLD_PX', {
14129
+ enumerable: true,
14130
+ get: function () {
14131
+ return _copilotkit_core.ɵKEYBOARD_OPEN_THRESHOLD_PX;
14132
+ }
14133
+ });
14134
+ Object.defineProperty(exports, 'ɵLICENSE_BANNER_OFFSET', {
14135
+ enumerable: true,
14136
+ get: function () {
14137
+ return _copilotkit_core.ɵLICENSE_BANNER_OFFSET;
14138
+ }
14139
+ });
14140
+ Object.defineProperty(exports, 'ɵLICENSE_BANNER_STYLE', {
14141
+ enumerable: true,
14142
+ get: function () {
14143
+ return _copilotkit_core.ɵLICENSE_BANNER_STYLE;
14144
+ }
14145
+ });
14621
14146
  Object.defineProperty(exports, 'ɵMAX_SOCKET_RETRIES', {
14622
14147
  enumerable: true,
14623
14148
  get: function () {
14624
14149
  return _copilotkit_core.ɵMAX_SOCKET_RETRIES;
14625
14150
  }
14626
14151
  });
14152
+ Object.defineProperty(exports, 'ɵMESSAGE_FEEDBACK_EVENT_NAME', {
14153
+ enumerable: true,
14154
+ get: function () {
14155
+ return _copilotkit_core.ɵMESSAGE_FEEDBACK_EVENT_NAME;
14156
+ }
14157
+ });
14158
+ Object.defineProperty(exports, 'ɵMESSAGE_FEEDBACK_MAX_COMMENT_LENGTH', {
14159
+ enumerable: true,
14160
+ get: function () {
14161
+ return _copilotkit_core.ɵMESSAGE_FEEDBACK_MAX_COMMENT_LENGTH;
14162
+ }
14163
+ });
14164
+ Object.defineProperty(exports, 'ɵMOBILE_MAX_WIDTH_QUERY', {
14165
+ enumerable: true,
14166
+ get: function () {
14167
+ return _copilotkit_core.ɵMOBILE_MAX_WIDTH_QUERY;
14168
+ }
14169
+ });
14627
14170
  Object.defineProperty(exports, 'ɵOpenGenerativeUIController', {
14628
14171
  enumerable: true,
14629
14172
  get: function () {
@@ -14648,6 +14191,12 @@ Object.defineProperty(exports, 'ɵclearAgentInterruptState', {
14648
14191
  return _copilotkit_core.ɵclearAgentInterruptState;
14649
14192
  }
14650
14193
  });
14194
+ Object.defineProperty(exports, 'ɵcn', {
14195
+ enumerable: true,
14196
+ get: function () {
14197
+ return _copilotkit_core.ɵcn;
14198
+ }
14199
+ });
14651
14200
  Object.defineProperty(exports, 'ɵcomposerButtonState', {
14652
14201
  enumerable: true,
14653
14202
  get: function () {
@@ -14702,6 +14251,12 @@ Object.defineProperty(exports, 'ɵextractCompleteStyles', {
14702
14251
  return _copilotkit_core.ɵextractCompleteStyles;
14703
14252
  }
14704
14253
  });
14254
+ Object.defineProperty(exports, 'ɵflattenUserMessageContent', {
14255
+ enumerable: true,
14256
+ get: function () {
14257
+ return _copilotkit_core.ɵflattenUserMessageContent;
14258
+ }
14259
+ });
14705
14260
  Object.defineProperty(exports, 'ɵformatCountLabel', {
14706
14261
  enumerable: true,
14707
14262
  get: function () {
@@ -14720,6 +14275,12 @@ Object.defineProperty(exports, 'ɵformatReasoningDuration', {
14720
14275
  return _copilotkit_core.ɵformatReasoningDuration;
14721
14276
  }
14722
14277
  });
14278
+ Object.defineProperty(exports, 'ɵformatReasoningDurationLabel', {
14279
+ enumerable: true,
14280
+ get: function () {
14281
+ return _copilotkit_core.ɵformatReasoningDurationLabel;
14282
+ }
14283
+ });
14723
14284
  Object.defineProperty(exports, 'ɵformatToolNames', {
14724
14285
  enumerable: true,
14725
14286
  get: function () {
@@ -14744,12 +14305,42 @@ Object.defineProperty(exports, 'ɵgetArgumentPreview', {
14744
14305
  return _copilotkit_core.ɵgetArgumentPreview;
14745
14306
  }
14746
14307
  });
14308
+ Object.defineProperty(exports, 'ɵgetBranchNavState', {
14309
+ enumerable: true,
14310
+ get: function () {
14311
+ return _copilotkit_core.ɵgetBranchNavState;
14312
+ }
14313
+ });
14314
+ Object.defineProperty(exports, 'ɵgetInlineFeatureWarningSpec', {
14315
+ enumerable: true,
14316
+ get: function () {
14317
+ return _copilotkit_core.ɵgetInlineFeatureWarningSpec;
14318
+ }
14319
+ });
14747
14320
  Object.defineProperty(exports, 'ɵgetLatestTurnKey', {
14748
14321
  enumerable: true,
14749
14322
  get: function () {
14750
14323
  return _copilotkit_core.ɵgetLatestTurnKey;
14751
14324
  }
14752
14325
  });
14326
+ Object.defineProperty(exports, 'ɵgetLicenseBannerSpec', {
14327
+ enumerable: true,
14328
+ get: function () {
14329
+ return _copilotkit_core.ɵgetLicenseBannerSpec;
14330
+ }
14331
+ });
14332
+ Object.defineProperty(exports, 'ɵgetMessageFeedback', {
14333
+ enumerable: true,
14334
+ get: function () {
14335
+ return _copilotkit_core.ɵgetMessageFeedback;
14336
+ }
14337
+ });
14338
+ Object.defineProperty(exports, 'ɵgetMessageFeedbackControls', {
14339
+ enumerable: true,
14340
+ get: function () {
14341
+ return _copilotkit_core.ɵgetMessageFeedbackControls;
14342
+ }
14343
+ });
14753
14344
  Object.defineProperty(exports, 'ɵgetToolCallLayouts', {
14754
14345
  enumerable: true,
14755
14346
  get: function () {
@@ -14786,12 +14377,60 @@ Object.defineProperty(exports, 'ɵgetTurnWork', {
14786
14377
  return _copilotkit_core.ɵgetTurnWork;
14787
14378
  }
14788
14379
  });
14380
+ Object.defineProperty(exports, 'ɵgetUserMessageMediaFilename', {
14381
+ enumerable: true,
14382
+ get: function () {
14383
+ return _copilotkit_core.ɵgetUserMessageMediaFilename;
14384
+ }
14385
+ });
14386
+ Object.defineProperty(exports, 'ɵgetUserMessageMediaParts', {
14387
+ enumerable: true,
14388
+ get: function () {
14389
+ return _copilotkit_core.ɵgetUserMessageMediaParts;
14390
+ }
14391
+ });
14789
14392
  Object.defineProperty(exports, 'ɵgetWorkOpenState', {
14790
14393
  enumerable: true,
14791
14394
  get: function () {
14792
14395
  return _copilotkit_core.ɵgetWorkOpenState;
14793
14396
  }
14794
14397
  });
14398
+ Object.defineProperty(exports, 'ɵgetWorkSummaryText', {
14399
+ enumerable: true,
14400
+ get: function () {
14401
+ return _copilotkit_core.ɵgetWorkSummaryText;
14402
+ }
14403
+ });
14404
+ Object.defineProperty(exports, 'ɵhasAssistantMessageText', {
14405
+ enumerable: true,
14406
+ get: function () {
14407
+ return _copilotkit_core.ɵhasAssistantMessageText;
14408
+ }
14409
+ });
14410
+ Object.defineProperty(exports, 'ɵinitialKeyboardState', {
14411
+ enumerable: true,
14412
+ get: function () {
14413
+ return _copilotkit_core.ɵinitialKeyboardState;
14414
+ }
14415
+ });
14416
+ Object.defineProperty(exports, 'ɵinspectorKiteFill', {
14417
+ enumerable: true,
14418
+ get: function () {
14419
+ return _copilotkit_core.ɵinspectorKiteFill;
14420
+ }
14421
+ });
14422
+ Object.defineProperty(exports, 'ɵinspectorKiteIcon', {
14423
+ enumerable: true,
14424
+ get: function () {
14425
+ return _copilotkit_core.ɵinspectorKiteIcon;
14426
+ }
14427
+ });
14428
+ Object.defineProperty(exports, 'ɵinspectorShortcuts', {
14429
+ enumerable: true,
14430
+ get: function () {
14431
+ return _copilotkit_core.ɵinspectorShortcuts;
14432
+ }
14433
+ });
14795
14434
  Object.defineProperty(exports, 'ɵisCopilotKitFeature', {
14796
14435
  enumerable: true,
14797
14436
  get: function () {
@@ -14804,6 +14443,18 @@ Object.defineProperty(exports, 'ɵisHttpAgent', {
14804
14443
  return _copilotkit_core.ɵisHttpAgent;
14805
14444
  }
14806
14445
  });
14446
+ Object.defineProperty(exports, 'ɵisLearningFeedbackEnabled', {
14447
+ enumerable: true,
14448
+ get: function () {
14449
+ return _copilotkit_core.ɵisLearningFeedbackEnabled;
14450
+ }
14451
+ });
14452
+ Object.defineProperty(exports, 'ɵisMobileViewport', {
14453
+ enumerable: true,
14454
+ get: function () {
14455
+ return _copilotkit_core.ɵisMobileViewport;
14456
+ }
14457
+ });
14807
14458
  Object.defineProperty(exports, 'ɵisRetryableMemoryStatus', {
14808
14459
  enumerable: true,
14809
14460
  get: function () {
@@ -14870,6 +14521,12 @@ Object.defineProperty(exports, 'ɵmessagesFingerprint', {
14870
14521
  return _copilotkit_core.ɵmessagesFingerprint;
14871
14522
  }
14872
14523
  });
14524
+ Object.defineProperty(exports, 'ɵnormalizeAutoScroll', {
14525
+ enumerable: true,
14526
+ get: function () {
14527
+ return _copilotkit_core.ɵnormalizeAutoScroll;
14528
+ }
14529
+ });
14873
14530
  Object.defineProperty(exports, 'ɵobservePhoenixEvent$', {
14874
14531
  enumerable: true,
14875
14532
  get: function () {
@@ -14906,6 +14563,12 @@ Object.defineProperty(exports, 'ɵphoenixSocket$', {
14906
14563
  return _copilotkit_core.ɵphoenixSocket$;
14907
14564
  }
14908
14565
  });
14566
+ Object.defineProperty(exports, 'ɵpinMessageToTop', {
14567
+ enumerable: true,
14568
+ get: function () {
14569
+ return _copilotkit_core.ɵpinMessageToTop;
14570
+ }
14571
+ });
14909
14572
  Object.defineProperty(exports, 'ɵpluralize', {
14910
14573
  enumerable: true,
14911
14574
  get: function () {
@@ -14918,12 +14581,30 @@ Object.defineProperty(exports, 'ɵprocessPartialHtml', {
14918
14581
  return _copilotkit_core.ɵprocessPartialHtml;
14919
14582
  }
14920
14583
  });
14584
+ Object.defineProperty(exports, 'ɵreadKeyboardState', {
14585
+ enumerable: true,
14586
+ get: function () {
14587
+ return _copilotkit_core.ɵreadKeyboardState;
14588
+ }
14589
+ });
14921
14590
  Object.defineProperty(exports, 'ɵrecordWorkTime', {
14922
14591
  enumerable: true,
14923
14592
  get: function () {
14924
14593
  return _copilotkit_core.ɵrecordWorkTime;
14925
14594
  }
14926
14595
  });
14596
+ Object.defineProperty(exports, 'ɵreserveLicenseBannerOffset', {
14597
+ enumerable: true,
14598
+ get: function () {
14599
+ return _copilotkit_core.ɵreserveLicenseBannerOffset;
14600
+ }
14601
+ });
14602
+ Object.defineProperty(exports, 'ɵresetMessageFeedbackCache', {
14603
+ enumerable: true,
14604
+ get: function () {
14605
+ return _copilotkit_core.ɵresetMessageFeedbackCache;
14606
+ }
14607
+ });
14927
14608
  Object.defineProperty(exports, 'ɵresolveActivityRenderer', {
14928
14609
  enumerable: true,
14929
14610
  get: function () {
@@ -15044,12 +14725,42 @@ Object.defineProperty(exports, 'ɵselectThreadsIsLoading', {
15044
14725
  return _copilotkit_core.ɵselectThreadsIsLoading;
15045
14726
  }
15046
14727
  });
14728
+ Object.defineProperty(exports, 'ɵsetMessageFeedback', {
14729
+ enumerable: true,
14730
+ get: function () {
14731
+ return _copilotkit_core.ɵsetMessageFeedback;
14732
+ }
14733
+ });
14734
+ Object.defineProperty(exports, 'ɵshallowEqualRecord', {
14735
+ enumerable: true,
14736
+ get: function () {
14737
+ return _copilotkit_core.ɵshallowEqualRecord;
14738
+ }
14739
+ });
14740
+ Object.defineProperty(exports, 'ɵshouldShowAssistantToolbar', {
14741
+ enumerable: true,
14742
+ get: function () {
14743
+ return _copilotkit_core.ɵshouldShowAssistantToolbar;
14744
+ }
14745
+ });
15047
14746
  Object.defineProperty(exports, 'ɵstringifyToolCallPayload', {
15048
14747
  enumerable: true,
15049
14748
  get: function () {
15050
14749
  return _copilotkit_core.ɵstringifyToolCallPayload;
15051
14750
  }
15052
14751
  });
14752
+ Object.defineProperty(exports, 'ɵsubscribeToLearningFeedbackEnabled', {
14753
+ enumerable: true,
14754
+ get: function () {
14755
+ return _copilotkit_core.ɵsubscribeToLearningFeedbackEnabled;
14756
+ }
14757
+ });
14758
+ Object.defineProperty(exports, 'ɵsubscribeToMessageFeedback', {
14759
+ enumerable: true,
14760
+ get: function () {
14761
+ return _copilotkit_core.ɵsubscribeToMessageFeedback;
14762
+ }
14763
+ });
15053
14764
  Object.defineProperty(exports, 'ɵthreadAdapterEvents', {
15054
14765
  enumerable: true,
15055
14766
  get: function () {
@@ -15068,6 +14779,18 @@ Object.defineProperty(exports, 'ɵtranscriptionErrorMessageKey', {
15068
14779
  return _copilotkit_core.ɵtranscriptionErrorMessageKey;
15069
14780
  }
15070
14781
  });
14782
+ Object.defineProperty(exports, 'ɵwatchKeyboardState', {
14783
+ enumerable: true,
14784
+ get: function () {
14785
+ return _copilotkit_core.ɵwatchKeyboardState;
14786
+ }
14787
+ });
14788
+ Object.defineProperty(exports, 'ɵwatchMobileViewport', {
14789
+ enumerable: true,
14790
+ get: function () {
14791
+ return _copilotkit_core.ɵwatchMobileViewport;
14792
+ }
14793
+ });
15071
14794
  Object.defineProperty(exports, 'ɵwithHeaderDefaults', {
15072
14795
  enumerable: true,
15073
14796
  get: function () {