@copilotkitnext/react 0.0.22-alpha.9 → 0.0.22

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.mjs CHANGED
@@ -1,24 +1,27 @@
1
- import * as React2 from 'react';
2
- import React2__default, { createContext, forwardRef, useRef, useEffect, useImperativeHandle, useMemo, useCallback, useState, useContext, useLayoutEffect, useReducer, useSyncExternalStore } from 'react';
3
- import { twMerge } from 'tailwind-merge';
4
- import { ArrowUp, Mic, X, Check, Plus, Copy, ThumbsUp, ThumbsDown, Volume2, RefreshCw, Edit, ChevronLeft, ChevronRight, Loader2, ChevronDown, ChevronRightIcon, Square, MessageCircle } from 'lucide-react';
5
- import { DEFAULT_AGENT_ID, randomUUID, partialJSONParse } from '@copilotkitnext/shared';
6
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
- import { Slot } from '@radix-ui/react-slot';
8
- import { cva } from 'class-variance-authority';
9
- import { clsx } from 'clsx';
10
- import * as TooltipPrimitive from '@radix-ui/react-tooltip';
11
- import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
12
- import 'katex/dist/katex.min.css';
13
- import { Streamdown } from 'streamdown';
14
- import { ToolCallStatus, CopilotKitCore } from '@copilotkitnext/core';
15
- import { z } from 'zod';
16
- import { createComponent } from '@lit-labs/react';
17
- import { defineWebInspector, WebInspectorElement, WEB_INSPECTOR_TAG } from '@copilotkitnext/web-inspector';
18
- import { useStickToBottom, StickToBottom, useStickToBottomContext } from 'use-stick-to-bottom';
19
- import { merge } from 'ts-deepmerge';
20
- import { AGUIConnectNotImplementedError } from '@ag-ui/client';
1
+ "use client";
21
2
 
3
+ // src/index.ts
4
+ export * from "@ag-ui/core";
5
+ export * from "@ag-ui/client";
6
+
7
+ // src/components/chat/CopilotChatInput.tsx
8
+ import {
9
+ useState as useState2,
10
+ useRef as useRef2,
11
+ useEffect as useEffect2,
12
+ useLayoutEffect,
13
+ forwardRef as forwardRef2,
14
+ useImperativeHandle as useImperativeHandle2,
15
+ useCallback,
16
+ useMemo as useMemo2
17
+ } from "react";
18
+ import { twMerge as twMerge3 } from "tailwind-merge";
19
+ import { Plus, Mic, ArrowUp, X, Check, Square } from "lucide-react";
20
+
21
+ // src/providers/CopilotChatConfigurationProvider.tsx
22
+ import { createContext, useContext, useMemo, useState } from "react";
23
+ import { DEFAULT_AGENT_ID, randomUUID } from "@copilotkitnext/shared";
24
+ import { jsx } from "react/jsx-runtime";
22
25
  var CopilotChatDefaultLabels = {
23
26
  chatInputPlaceholder: "Type a message...",
24
27
  chatInputToolbarStartTranscribeButtonLabel: "Transcribe",
@@ -91,9 +94,20 @@ var useCopilotChatConfiguration = () => {
91
94
  const configuration = useContext(CopilotChatConfiguration);
92
95
  return configuration;
93
96
  };
97
+
98
+ // src/components/ui/button.tsx
99
+ import { Slot } from "@radix-ui/react-slot";
100
+ import { cva } from "class-variance-authority";
101
+
102
+ // src/lib/utils.ts
103
+ import { clsx } from "clsx";
104
+ import { twMerge } from "tailwind-merge";
94
105
  function cn(...inputs) {
95
106
  return twMerge(clsx(inputs));
96
107
  }
108
+
109
+ // src/components/ui/button.tsx
110
+ import { jsx as jsx2 } from "react/jsx-runtime";
97
111
  var buttonVariants = cva(
98
112
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
99
113
  {
@@ -191,7 +205,7 @@ function Button({
191
205
  ...props
192
206
  }) {
193
207
  const Comp = asChild ? Slot : "button";
194
- return /* @__PURE__ */ jsx(
208
+ return /* @__PURE__ */ jsx2(
195
209
  Comp,
196
210
  {
197
211
  "data-slot": "button",
@@ -200,11 +214,15 @@ function Button({
200
214
  }
201
215
  );
202
216
  }
217
+
218
+ // src/components/ui/tooltip.tsx
219
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
220
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
203
221
  function TooltipProvider({
204
222
  delayDuration = 0,
205
223
  ...props
206
224
  }) {
207
- return /* @__PURE__ */ jsx(
225
+ return /* @__PURE__ */ jsx3(
208
226
  TooltipPrimitive.Provider,
209
227
  {
210
228
  "data-slot": "tooltip-provider",
@@ -216,12 +234,12 @@ function TooltipProvider({
216
234
  function Tooltip({
217
235
  ...props
218
236
  }) {
219
- return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
237
+ return /* @__PURE__ */ jsx3(TooltipProvider, { children: /* @__PURE__ */ jsx3(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
220
238
  }
221
239
  function TooltipTrigger({
222
240
  ...props
223
241
  }) {
224
- return /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
242
+ return /* @__PURE__ */ jsx3(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
225
243
  }
226
244
  function TooltipContent({
227
245
  className,
@@ -229,7 +247,7 @@ function TooltipContent({
229
247
  children,
230
248
  ...props
231
249
  }) {
232
- return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
250
+ return /* @__PURE__ */ jsx3(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
233
251
  TooltipPrimitive.Content,
234
252
  {
235
253
  "data-slot": "tooltip-content",
@@ -241,20 +259,25 @@ function TooltipContent({
241
259
  ...props,
242
260
  children: [
243
261
  children,
244
- /* @__PURE__ */ jsx(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
262
+ /* @__PURE__ */ jsx3(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
245
263
  ]
246
264
  }
247
265
  ) });
248
266
  }
267
+
268
+ // src/components/ui/dropdown-menu.tsx
269
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
270
+ import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
271
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
249
272
  function DropdownMenu({
250
273
  ...props
251
274
  }) {
252
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
275
+ return /* @__PURE__ */ jsx4(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
253
276
  }
254
277
  function DropdownMenuTrigger({
255
278
  ...props
256
279
  }) {
257
- return /* @__PURE__ */ jsx(
280
+ return /* @__PURE__ */ jsx4(
258
281
  DropdownMenuPrimitive.Trigger,
259
282
  {
260
283
  "data-slot": "dropdown-menu-trigger",
@@ -267,7 +290,7 @@ function DropdownMenuContent({
267
290
  sideOffset = 4,
268
291
  ...props
269
292
  }) {
270
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
293
+ return /* @__PURE__ */ jsx4(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx4(
271
294
  DropdownMenuPrimitive.Content,
272
295
  {
273
296
  "data-slot": "dropdown-menu-content",
@@ -286,7 +309,7 @@ function DropdownMenuItem({
286
309
  variant = "default",
287
310
  ...props
288
311
  }) {
289
- return /* @__PURE__ */ jsx(
312
+ return /* @__PURE__ */ jsx4(
290
313
  DropdownMenuPrimitive.Item,
291
314
  {
292
315
  "data-slot": "dropdown-menu-item",
@@ -304,7 +327,7 @@ function DropdownMenuSeparator({
304
327
  className,
305
328
  ...props
306
329
  }) {
307
- return /* @__PURE__ */ jsx(
330
+ return /* @__PURE__ */ jsx4(
308
331
  DropdownMenuPrimitive.Separator,
309
332
  {
310
333
  "data-slot": "dropdown-menu-separator",
@@ -316,7 +339,7 @@ function DropdownMenuSeparator({
316
339
  function DropdownMenuSub({
317
340
  ...props
318
341
  }) {
319
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Sub, { "data-slot": "dropdown-menu-sub", ...props });
342
+ return /* @__PURE__ */ jsx4(DropdownMenuPrimitive.Sub, { "data-slot": "dropdown-menu-sub", ...props });
320
343
  }
321
344
  function DropdownMenuSubTrigger({
322
345
  className,
@@ -324,7 +347,7 @@ function DropdownMenuSubTrigger({
324
347
  children,
325
348
  ...props
326
349
  }) {
327
- return /* @__PURE__ */ jsxs(
350
+ return /* @__PURE__ */ jsxs2(
328
351
  DropdownMenuPrimitive.SubTrigger,
329
352
  {
330
353
  "data-slot": "dropdown-menu-sub-trigger",
@@ -336,7 +359,7 @@ function DropdownMenuSubTrigger({
336
359
  ...props,
337
360
  children: [
338
361
  children,
339
- /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto size-4" })
362
+ /* @__PURE__ */ jsx4(ChevronRightIcon, { className: "ml-auto size-4" })
340
363
  ]
341
364
  }
342
365
  );
@@ -345,7 +368,7 @@ function DropdownMenuSubContent({
345
368
  className,
346
369
  ...props
347
370
  }) {
348
- return /* @__PURE__ */ jsx(
371
+ return /* @__PURE__ */ jsx4(
349
372
  DropdownMenuPrimitive.SubContent,
350
373
  {
351
374
  "data-slot": "dropdown-menu-sub-content",
@@ -357,6 +380,11 @@ function DropdownMenuSubContent({
357
380
  }
358
381
  );
359
382
  }
383
+
384
+ // src/components/chat/CopilotChatAudioRecorder.tsx
385
+ import { useRef, useEffect, useImperativeHandle, forwardRef } from "react";
386
+ import { twMerge as twMerge2 } from "tailwind-merge";
387
+ import { jsx as jsx5 } from "react/jsx-runtime";
360
388
  var AudioRecorderError = class extends Error {
361
389
  constructor(message) {
362
390
  super(message);
@@ -443,7 +471,7 @@ var CopilotChatAudioRecorder = forwardRef((props, ref) => {
443
471
  }),
444
472
  []
445
473
  );
446
- return /* @__PURE__ */ jsx("div", { className: twMerge("h-[44px] w-full px-5", className), ...divProps, children: /* @__PURE__ */ jsx(
474
+ return /* @__PURE__ */ jsx5("div", { className: twMerge2("h-[44px] w-full px-5", className), ...divProps, children: /* @__PURE__ */ jsx5(
447
475
  "canvas",
448
476
  {
449
477
  ref: canvasRef,
@@ -453,25 +481,31 @@ var CopilotChatAudioRecorder = forwardRef((props, ref) => {
453
481
  ) });
454
482
  });
455
483
  CopilotChatAudioRecorder.displayName = "WebAudioRecorder";
484
+
485
+ // src/lib/slots.tsx
486
+ import React2 from "react";
456
487
  function renderSlot(slot, DefaultComponent, props) {
457
488
  if (typeof slot === "string") {
458
- return React2__default.createElement(DefaultComponent, {
489
+ return React2.createElement(DefaultComponent, {
459
490
  ...props,
460
491
  className: slot
461
492
  });
462
493
  }
463
494
  if (typeof slot === "function") {
464
495
  const Comp = slot;
465
- return React2__default.createElement(Comp, props);
496
+ return React2.createElement(Comp, props);
466
497
  }
467
- if (slot && typeof slot === "object" && !React2__default.isValidElement(slot)) {
468
- return React2__default.createElement(DefaultComponent, {
498
+ if (slot && typeof slot === "object" && !React2.isValidElement(slot)) {
499
+ return React2.createElement(DefaultComponent, {
469
500
  ...props,
470
501
  ...slot
471
502
  });
472
503
  }
473
- return React2__default.createElement(DefaultComponent, props);
504
+ return React2.createElement(DefaultComponent, props);
474
505
  }
506
+
507
+ // src/components/chat/CopilotChatInput.tsx
508
+ import { Fragment, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
475
509
  var SLASH_MENU_MAX_VISIBLE_ITEMS = 5;
476
510
  var SLASH_MENU_ITEM_HEIGHT_PX = 40;
477
511
  function CopilotChatInput({
@@ -499,36 +533,36 @@ function CopilotChatInput({
499
533
  ...props
500
534
  }) {
501
535
  const isControlled = value !== void 0;
502
- const [internalValue, setInternalValue] = useState(() => value ?? "");
503
- useEffect(() => {
536
+ const [internalValue, setInternalValue] = useState2(() => value ?? "");
537
+ useEffect2(() => {
504
538
  if (!isControlled && value !== void 0) {
505
539
  setInternalValue(value);
506
540
  }
507
541
  }, [isControlled, value]);
508
542
  const resolvedValue = isControlled ? value ?? "" : internalValue;
509
- const [layout, setLayout] = useState("compact");
510
- const ignoreResizeRef = useRef(false);
511
- const resizeEvaluationRafRef = useRef(null);
543
+ const [layout, setLayout] = useState2("compact");
544
+ const ignoreResizeRef = useRef2(false);
545
+ const resizeEvaluationRafRef = useRef2(null);
512
546
  const isExpanded = mode === "input" && layout === "expanded";
513
- const [commandQuery, setCommandQuery] = useState(null);
514
- const [slashHighlightIndex, setSlashHighlightIndex] = useState(0);
515
- const inputRef = useRef(null);
516
- const gridRef = useRef(null);
517
- const addButtonContainerRef = useRef(null);
518
- const actionsContainerRef = useRef(null);
519
- const audioRecorderRef = useRef(null);
520
- const slashMenuRef = useRef(null);
547
+ const [commandQuery, setCommandQuery] = useState2(null);
548
+ const [slashHighlightIndex, setSlashHighlightIndex] = useState2(0);
549
+ const inputRef = useRef2(null);
550
+ const gridRef = useRef2(null);
551
+ const addButtonContainerRef = useRef2(null);
552
+ const actionsContainerRef = useRef2(null);
553
+ const audioRecorderRef = useRef2(null);
554
+ const slashMenuRef = useRef2(null);
521
555
  const config = useCopilotChatConfiguration();
522
556
  const labels = config?.labels ?? CopilotChatDefaultLabels;
523
- const previousModalStateRef = useRef(void 0);
524
- const measurementCanvasRef = useRef(null);
525
- const measurementsRef = useRef({
557
+ const previousModalStateRef = useRef2(void 0);
558
+ const measurementCanvasRef = useRef2(null);
559
+ const measurementsRef = useRef2({
526
560
  singleLineHeight: 0,
527
561
  maxHeight: 0,
528
562
  paddingLeft: 0,
529
563
  paddingRight: 0
530
564
  });
531
- const commandItems = useMemo(() => {
565
+ const commandItems = useMemo2(() => {
532
566
  const entries = [];
533
567
  const seen = /* @__PURE__ */ new Set();
534
568
  const pushItem = (item) => {
@@ -559,7 +593,7 @@ function CopilotChatInput({
559
593
  }
560
594
  return entries;
561
595
  }, [labels.chatInputToolbarAddButtonLabel, onAddFile, toolsMenu]);
562
- const filteredCommands = useMemo(() => {
596
+ const filteredCommands = useMemo2(() => {
563
597
  if (commandQuery === null) {
564
598
  return [];
565
599
  }
@@ -582,7 +616,7 @@ function CopilotChatInput({
582
616
  }
583
617
  return [...startsWith, ...contains];
584
618
  }, [commandItems, commandQuery]);
585
- useEffect(() => {
619
+ useEffect2(() => {
586
620
  if (!autoFocus) {
587
621
  previousModalStateRef.current = config?.isModalOpen;
588
622
  return;
@@ -592,19 +626,19 @@ function CopilotChatInput({
592
626
  }
593
627
  previousModalStateRef.current = config?.isModalOpen;
594
628
  }, [config?.isModalOpen, autoFocus]);
595
- useEffect(() => {
629
+ useEffect2(() => {
596
630
  if (commandItems.length === 0 && commandQuery !== null) {
597
631
  setCommandQuery(null);
598
632
  }
599
633
  }, [commandItems.length, commandQuery]);
600
- const previousCommandQueryRef = useRef(null);
601
- useEffect(() => {
634
+ const previousCommandQueryRef = useRef2(null);
635
+ useEffect2(() => {
602
636
  if (commandQuery !== null && commandQuery !== previousCommandQueryRef.current && filteredCommands.length > 0) {
603
637
  setSlashHighlightIndex(0);
604
638
  }
605
639
  previousCommandQueryRef.current = commandQuery;
606
640
  }, [commandQuery, filteredCommands.length]);
607
- useEffect(() => {
641
+ useEffect2(() => {
608
642
  if (commandQuery === null) {
609
643
  setSlashHighlightIndex(0);
610
644
  return;
@@ -615,7 +649,7 @@ function CopilotChatInput({
615
649
  setSlashHighlightIndex(0);
616
650
  }
617
651
  }, [commandQuery, filteredCommands, slashHighlightIndex]);
618
- useEffect(() => {
652
+ useEffect2(() => {
619
653
  const recorder = audioRecorderRef.current;
620
654
  if (!recorder) {
621
655
  return;
@@ -628,7 +662,7 @@ function CopilotChatInput({
628
662
  }
629
663
  }
630
664
  }, [mode]);
631
- useEffect(() => {
665
+ useEffect2(() => {
632
666
  if (mode !== "input") {
633
667
  setLayout("compact");
634
668
  setCommandQuery(null);
@@ -650,7 +684,7 @@ function CopilotChatInput({
650
684
  },
651
685
  [commandItems.length]
652
686
  );
653
- useEffect(() => {
687
+ useEffect2(() => {
654
688
  updateSlashState(resolvedValue);
655
689
  }, [resolvedValue, updateSlashState]);
656
690
  const handleChange = (e) => {
@@ -757,7 +791,7 @@ function CopilotChatInput({
757
791
  onChange: handleChange,
758
792
  onKeyDown: handleKeyDown,
759
793
  autoFocus,
760
- className: twMerge(
794
+ className: twMerge3(
761
795
  "w-full py-3",
762
796
  isExpanded ? "px-5" : "pr-5"
763
797
  )
@@ -778,7 +812,7 @@ function CopilotChatInput({
778
812
  const BoundSendButton = renderSlot(sendButton, CopilotChatInput.SendButton, {
779
813
  onClick: handleSendButtonClick,
780
814
  disabled: isProcessing ? !canStop : !canSend,
781
- children: isProcessing && canStop ? /* @__PURE__ */ jsx(Square, { className: "size-[18px] fill-current" }) : void 0
815
+ children: isProcessing && canStop ? /* @__PURE__ */ jsx6(Square, { className: "size-[18px] fill-current" }) : void 0
782
816
  });
783
817
  const BoundStartTranscribeButton = renderSlot(startTranscribeButton, CopilotChatInput.StartTranscribeButton, {
784
818
  onClick: onStartTranscribe
@@ -814,7 +848,7 @@ function CopilotChatInput({
814
848
  toolsMenu,
815
849
  autoFocus
816
850
  };
817
- return /* @__PURE__ */ jsx(Fragment, { children: children(childProps) });
851
+ return /* @__PURE__ */ jsx6(Fragment, { children: children(childProps) });
818
852
  }
819
853
  const handleContainerClick = (e) => {
820
854
  const target = e.target;
@@ -953,7 +987,7 @@ function CopilotChatInput({
953
987
  useLayoutEffect(() => {
954
988
  evaluateLayout();
955
989
  }, [evaluateLayout]);
956
- useEffect(() => {
990
+ useEffect2(() => {
957
991
  if (typeof ResizeObserver === "undefined") {
958
992
  return;
959
993
  }
@@ -997,7 +1031,7 @@ function CopilotChatInput({
997
1031
  };
998
1032
  }, [evaluateLayout]);
999
1033
  const slashMenuVisible = commandQuery !== null && commandItems.length > 0;
1000
- useEffect(() => {
1034
+ useEffect2(() => {
1001
1035
  if (!slashMenuVisible || slashHighlightIndex < 0) {
1002
1036
  return;
1003
1037
  }
@@ -1006,7 +1040,7 @@ function CopilotChatInput({
1006
1040
  );
1007
1041
  active?.scrollIntoView({ block: "nearest" });
1008
1042
  }, [slashMenuVisible, slashHighlightIndex]);
1009
- const slashMenu = slashMenuVisible ? /* @__PURE__ */ jsx(
1043
+ const slashMenu = slashMenuVisible ? /* @__PURE__ */ jsx6(
1010
1044
  "div",
1011
1045
  {
1012
1046
  "data-testid": "copilot-slash-menu",
@@ -1015,9 +1049,9 @@ function CopilotChatInput({
1015
1049
  ref: slashMenuRef,
1016
1050
  className: "absolute bottom-full left-0 right-0 z-30 mb-2 max-h-64 overflow-y-auto rounded-lg border border-border bg-white shadow-lg dark:border-[#3a3a3a] dark:bg-[#1f1f1f]",
1017
1051
  style: { maxHeight: `${SLASH_MENU_MAX_VISIBLE_ITEMS * SLASH_MENU_ITEM_HEIGHT_PX}px` },
1018
- children: filteredCommands.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-sm text-muted-foreground", children: "No commands found" }) : filteredCommands.map((item, index) => {
1052
+ children: filteredCommands.length === 0 ? /* @__PURE__ */ jsx6("div", { className: "px-3 py-2 text-sm text-muted-foreground", children: "No commands found" }) : filteredCommands.map((item, index) => {
1019
1053
  const isActive = index === slashHighlightIndex;
1020
- return /* @__PURE__ */ jsx(
1054
+ return /* @__PURE__ */ jsx6(
1021
1055
  "button",
1022
1056
  {
1023
1057
  type: "button",
@@ -1025,7 +1059,7 @@ function CopilotChatInput({
1025
1059
  "aria-selected": isActive,
1026
1060
  "data-active": isActive ? "true" : void 0,
1027
1061
  "data-slash-index": index,
1028
- className: twMerge(
1062
+ className: twMerge3(
1029
1063
  "w-full px-3 py-2 text-left text-sm transition-colors",
1030
1064
  "hover:bg-muted dark:hover:bg-[#2f2f2f]",
1031
1065
  isActive ? "bg-muted dark:bg-[#2f2f2f]" : "bg-transparent"
@@ -1042,10 +1076,10 @@ function CopilotChatInput({
1042
1076
  })
1043
1077
  }
1044
1078
  ) : null;
1045
- return /* @__PURE__ */ jsx(
1079
+ return /* @__PURE__ */ jsx6(
1046
1080
  "div",
1047
1081
  {
1048
- className: twMerge(
1082
+ className: twMerge3(
1049
1083
  // Layout
1050
1084
  "flex w-full flex-col items-center justify-center",
1051
1085
  // Interaction
@@ -1061,21 +1095,21 @@ function CopilotChatInput({
1061
1095
  onClick: handleContainerClick,
1062
1096
  ...props,
1063
1097
  "data-layout": isExpanded ? "expanded" : "compact",
1064
- children: /* @__PURE__ */ jsxs(
1098
+ children: /* @__PURE__ */ jsxs3(
1065
1099
  "div",
1066
1100
  {
1067
1101
  ref: gridRef,
1068
- className: twMerge(
1102
+ className: twMerge3(
1069
1103
  "grid w-full gap-x-3 gap-y-3 px-3 py-2",
1070
1104
  isExpanded ? "grid-cols-[auto_minmax(0,1fr)_auto] grid-rows-[auto_auto]" : "grid-cols-[auto_minmax(0,1fr)_auto] items-center"
1071
1105
  ),
1072
1106
  "data-layout": isExpanded ? "expanded" : "compact",
1073
1107
  children: [
1074
- /* @__PURE__ */ jsx(
1108
+ /* @__PURE__ */ jsx6(
1075
1109
  "div",
1076
1110
  {
1077
1111
  ref: addButtonContainerRef,
1078
- className: twMerge(
1112
+ className: twMerge3(
1079
1113
  "flex items-center",
1080
1114
  isExpanded ? "row-start-2" : "row-start-1",
1081
1115
  "col-start-1"
@@ -1083,31 +1117,31 @@ function CopilotChatInput({
1083
1117
  children: BoundAddMenuButton
1084
1118
  }
1085
1119
  ),
1086
- /* @__PURE__ */ jsx(
1120
+ /* @__PURE__ */ jsx6(
1087
1121
  "div",
1088
1122
  {
1089
- className: twMerge(
1123
+ className: twMerge3(
1090
1124
  "relative flex min-w-0 flex-col",
1091
1125
  isExpanded ? "col-span-3 row-start-1" : "col-start-2 row-start-1"
1092
1126
  ),
1093
- children: mode === "transcribe" ? BoundAudioRecorder : /* @__PURE__ */ jsxs(Fragment, { children: [
1127
+ children: mode === "transcribe" ? BoundAudioRecorder : /* @__PURE__ */ jsxs3(Fragment, { children: [
1094
1128
  BoundTextArea,
1095
1129
  slashMenu
1096
1130
  ] })
1097
1131
  }
1098
1132
  ),
1099
- /* @__PURE__ */ jsx(
1133
+ /* @__PURE__ */ jsx6(
1100
1134
  "div",
1101
1135
  {
1102
1136
  ref: actionsContainerRef,
1103
- className: twMerge(
1137
+ className: twMerge3(
1104
1138
  "flex items-center justify-end gap-2",
1105
1139
  isExpanded ? "col-start-3 row-start-2" : "col-start-3 row-start-1"
1106
1140
  ),
1107
- children: mode === "transcribe" ? /* @__PURE__ */ jsxs(Fragment, { children: [
1141
+ children: mode === "transcribe" ? /* @__PURE__ */ jsxs3(Fragment, { children: [
1108
1142
  onCancelTranscribe && BoundCancelTranscribeButton,
1109
1143
  onFinishTranscribe && BoundFinishTranscribeButton
1110
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1144
+ ] }) : /* @__PURE__ */ jsxs3(Fragment, { children: [
1111
1145
  onStartTranscribe && BoundStartTranscribeButton,
1112
1146
  BoundSendButton
1113
1147
  ] })
@@ -1120,7 +1154,7 @@ function CopilotChatInput({
1120
1154
  );
1121
1155
  }
1122
1156
  ((CopilotChatInput2) => {
1123
- CopilotChatInput2.SendButton = ({ className, children, ...props }) => /* @__PURE__ */ jsx("div", { className: "mr-[10px]", children: /* @__PURE__ */ jsx(
1157
+ CopilotChatInput2.SendButton = ({ className, children, ...props }) => /* @__PURE__ */ jsx6("div", { className: "mr-[10px]", children: /* @__PURE__ */ jsx6(
1124
1158
  Button,
1125
1159
  {
1126
1160
  type: "button",
@@ -1128,49 +1162,49 @@ function CopilotChatInput({
1128
1162
  size: "chatInputToolbarIcon",
1129
1163
  className,
1130
1164
  ...props,
1131
- children: children ?? /* @__PURE__ */ jsx(ArrowUp, { className: "size-[18px]" })
1165
+ children: children ?? /* @__PURE__ */ jsx6(ArrowUp, { className: "size-[18px]" })
1132
1166
  }
1133
1167
  ) });
1134
1168
  CopilotChatInput2.ToolbarButton = ({ icon, labelKey, defaultClassName, className, ...props }) => {
1135
1169
  const config = useCopilotChatConfiguration();
1136
1170
  const labels = config?.labels ?? CopilotChatDefaultLabels;
1137
- return /* @__PURE__ */ jsxs(Tooltip, { children: [
1138
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
1171
+ return /* @__PURE__ */ jsxs3(Tooltip, { children: [
1172
+ /* @__PURE__ */ jsx6(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx6(
1139
1173
  Button,
1140
1174
  {
1141
1175
  type: "button",
1142
1176
  variant: "chatInputToolbarSecondary",
1143
1177
  size: "chatInputToolbarIcon",
1144
- className: twMerge(defaultClassName, className),
1178
+ className: twMerge3(defaultClassName, className),
1145
1179
  ...props,
1146
1180
  children: icon
1147
1181
  }
1148
1182
  ) }),
1149
- /* @__PURE__ */ jsx(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsx("p", { children: labels[labelKey] }) })
1183
+ /* @__PURE__ */ jsx6(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsx6("p", { children: labels[labelKey] }) })
1150
1184
  ] });
1151
1185
  };
1152
- CopilotChatInput2.StartTranscribeButton = (props) => /* @__PURE__ */ jsx(
1186
+ CopilotChatInput2.StartTranscribeButton = (props) => /* @__PURE__ */ jsx6(
1153
1187
  CopilotChatInput2.ToolbarButton,
1154
1188
  {
1155
- icon: /* @__PURE__ */ jsx(Mic, { className: "size-[18px]" }),
1189
+ icon: /* @__PURE__ */ jsx6(Mic, { className: "size-[18px]" }),
1156
1190
  labelKey: "chatInputToolbarStartTranscribeButtonLabel",
1157
1191
  defaultClassName: "mr-2",
1158
1192
  ...props
1159
1193
  }
1160
1194
  );
1161
- CopilotChatInput2.CancelTranscribeButton = (props) => /* @__PURE__ */ jsx(
1195
+ CopilotChatInput2.CancelTranscribeButton = (props) => /* @__PURE__ */ jsx6(
1162
1196
  CopilotChatInput2.ToolbarButton,
1163
1197
  {
1164
- icon: /* @__PURE__ */ jsx(X, { className: "size-[18px]" }),
1198
+ icon: /* @__PURE__ */ jsx6(X, { className: "size-[18px]" }),
1165
1199
  labelKey: "chatInputToolbarCancelTranscribeButtonLabel",
1166
1200
  defaultClassName: "mr-2",
1167
1201
  ...props
1168
1202
  }
1169
1203
  );
1170
- CopilotChatInput2.FinishTranscribeButton = (props) => /* @__PURE__ */ jsx(
1204
+ CopilotChatInput2.FinishTranscribeButton = (props) => /* @__PURE__ */ jsx6(
1171
1205
  CopilotChatInput2.ToolbarButton,
1172
1206
  {
1173
- icon: /* @__PURE__ */ jsx(Check, { className: "size-[18px]" }),
1207
+ icon: /* @__PURE__ */ jsx6(Check, { className: "size-[18px]" }),
1174
1208
  labelKey: "chatInputToolbarFinishTranscribeButtonLabel",
1175
1209
  defaultClassName: "mr-[10px]",
1176
1210
  ...props
@@ -1179,7 +1213,7 @@ function CopilotChatInput({
1179
1213
  CopilotChatInput2.AddMenuButton = ({ className, toolsMenu, onAddFile, disabled, ...props }) => {
1180
1214
  const config = useCopilotChatConfiguration();
1181
1215
  const labels = config?.labels ?? CopilotChatDefaultLabels;
1182
- const menuItems = useMemo(() => {
1216
+ const menuItems = useMemo2(() => {
1183
1217
  const items = [];
1184
1218
  if (onAddFile) {
1185
1219
  items.push({
@@ -1210,48 +1244,48 @@ function CopilotChatInput({
1210
1244
  const renderMenuItems = useCallback(
1211
1245
  (items) => items.map((item, index) => {
1212
1246
  if (item === "-") {
1213
- return /* @__PURE__ */ jsx(DropdownMenuSeparator, {}, `separator-${index}`);
1247
+ return /* @__PURE__ */ jsx6(DropdownMenuSeparator, {}, `separator-${index}`);
1214
1248
  }
1215
1249
  if (item.items && item.items.length > 0) {
1216
- return /* @__PURE__ */ jsxs(DropdownMenuSub, { children: [
1217
- /* @__PURE__ */ jsx(DropdownMenuSubTrigger, { children: item.label }),
1218
- /* @__PURE__ */ jsx(DropdownMenuSubContent, { children: renderMenuItems(item.items) })
1250
+ return /* @__PURE__ */ jsxs3(DropdownMenuSub, { children: [
1251
+ /* @__PURE__ */ jsx6(DropdownMenuSubTrigger, { children: item.label }),
1252
+ /* @__PURE__ */ jsx6(DropdownMenuSubContent, { children: renderMenuItems(item.items) })
1219
1253
  ] }, `group-${index}`);
1220
1254
  }
1221
- return /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: item.action, children: item.label }, `item-${index}`);
1255
+ return /* @__PURE__ */ jsx6(DropdownMenuItem, { onClick: item.action, children: item.label }, `item-${index}`);
1222
1256
  }),
1223
1257
  []
1224
1258
  );
1225
1259
  const hasMenuItems = menuItems.length > 0;
1226
1260
  const isDisabled = disabled || !hasMenuItems;
1227
- return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
1228
- /* @__PURE__ */ jsxs(Tooltip, { children: [
1229
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
1261
+ return /* @__PURE__ */ jsxs3(DropdownMenu, { children: [
1262
+ /* @__PURE__ */ jsxs3(Tooltip, { children: [
1263
+ /* @__PURE__ */ jsx6(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx6(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx6(
1230
1264
  Button,
1231
1265
  {
1232
1266
  type: "button",
1233
1267
  variant: "chatInputToolbarSecondary",
1234
1268
  size: "chatInputToolbarIcon",
1235
- className: twMerge("ml-1", className),
1269
+ className: twMerge3("ml-1", className),
1236
1270
  disabled: isDisabled,
1237
1271
  ...props,
1238
- children: /* @__PURE__ */ jsx(Plus, { className: "size-[20px]" })
1272
+ children: /* @__PURE__ */ jsx6(Plus, { className: "size-[20px]" })
1239
1273
  }
1240
1274
  ) }) }),
1241
- /* @__PURE__ */ jsx(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsxs("p", { className: "flex items-center gap-1 text-xs font-medium", children: [
1242
- /* @__PURE__ */ jsx("span", { children: "Add files and more" }),
1243
- /* @__PURE__ */ jsx("code", { className: "rounded bg-[#4a4a4a] px-1 py-[1px] font-mono text-[11px] text-white dark:bg-[#e0e0e0] dark:text-black", children: "/" })
1275
+ /* @__PURE__ */ jsx6(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsxs3("p", { className: "flex items-center gap-1 text-xs font-medium", children: [
1276
+ /* @__PURE__ */ jsx6("span", { children: "Add files and more" }),
1277
+ /* @__PURE__ */ jsx6("code", { className: "rounded bg-[#4a4a4a] px-1 py-[1px] font-mono text-[11px] text-white dark:bg-[#e0e0e0] dark:text-black", children: "/" })
1244
1278
  ] }) })
1245
1279
  ] }),
1246
- hasMenuItems && /* @__PURE__ */ jsx(DropdownMenuContent, { side: "top", align: "start", children: renderMenuItems(menuItems) })
1280
+ hasMenuItems && /* @__PURE__ */ jsx6(DropdownMenuContent, { side: "top", align: "start", children: renderMenuItems(menuItems) })
1247
1281
  ] });
1248
1282
  };
1249
- CopilotChatInput2.TextArea = forwardRef(function TextArea2({ style, className, autoFocus, ...props }, ref) {
1250
- const internalTextareaRef = useRef(null);
1283
+ CopilotChatInput2.TextArea = forwardRef2(function TextArea2({ style, className, autoFocus, ...props }, ref) {
1284
+ const internalTextareaRef = useRef2(null);
1251
1285
  const config = useCopilotChatConfiguration();
1252
1286
  const labels = config?.labels ?? CopilotChatDefaultLabels;
1253
- useImperativeHandle(ref, () => internalTextareaRef.current);
1254
- useEffect(() => {
1287
+ useImperativeHandle2(ref, () => internalTextareaRef.current);
1288
+ useEffect2(() => {
1255
1289
  const textarea = internalTextareaRef.current;
1256
1290
  if (!textarea) return;
1257
1291
  const handleFocus = () => {
@@ -1262,12 +1296,12 @@ function CopilotChatInput({
1262
1296
  textarea.addEventListener("focus", handleFocus);
1263
1297
  return () => textarea.removeEventListener("focus", handleFocus);
1264
1298
  }, []);
1265
- useEffect(() => {
1299
+ useEffect2(() => {
1266
1300
  if (autoFocus) {
1267
1301
  internalTextareaRef.current?.focus();
1268
1302
  }
1269
1303
  }, [autoFocus]);
1270
- return /* @__PURE__ */ jsx(
1304
+ return /* @__PURE__ */ jsx6(
1271
1305
  "textarea",
1272
1306
  {
1273
1307
  ref: internalTextareaRef,
@@ -1278,7 +1312,7 @@ function CopilotChatInput({
1278
1312
  ...style
1279
1313
  },
1280
1314
  placeholder: labels.chatInputPlaceholder,
1281
- className: twMerge(
1315
+ className: twMerge3(
1282
1316
  "bg-transparent outline-none antialiased font-regular leading-relaxed text-[16px] placeholder:text-[#00000077] dark:placeholder:text-[#fffc]",
1283
1317
  className
1284
1318
  ),
@@ -1296,6 +1330,39 @@ CopilotChatInput.CancelTranscribeButton.displayName = "CopilotChatInput.CancelTr
1296
1330
  CopilotChatInput.FinishTranscribeButton.displayName = "CopilotChatInput.FinishTranscribeButton";
1297
1331
  CopilotChatInput.AddMenuButton.displayName = "CopilotChatInput.AddMenuButton";
1298
1332
  var CopilotChatInput_default = CopilotChatInput;
1333
+
1334
+ // src/components/chat/CopilotChatAssistantMessage.tsx
1335
+ import { useState as useState6 } from "react";
1336
+ import {
1337
+ Copy,
1338
+ Check as Check2,
1339
+ ThumbsUp,
1340
+ ThumbsDown,
1341
+ Volume2,
1342
+ RefreshCw
1343
+ } from "lucide-react";
1344
+ import { twMerge as twMerge4 } from "tailwind-merge";
1345
+ import "katex/dist/katex.min.css";
1346
+ import { Streamdown } from "streamdown";
1347
+
1348
+ // src/hooks/use-render-tool-call.tsx
1349
+ import { useCallback as useCallback2, useEffect as useEffect5, useState as useState4, useSyncExternalStore } from "react";
1350
+ import { ToolCallStatus } from "@copilotkitnext/core";
1351
+
1352
+ // src/providers/CopilotKitProvider.tsx
1353
+ import {
1354
+ createContext as createContext2,
1355
+ useContext as useContext2,
1356
+ useMemo as useMemo3,
1357
+ useEffect as useEffect4,
1358
+ useReducer,
1359
+ useRef as useRef4,
1360
+ useState as useState3
1361
+ } from "react";
1362
+ import { z } from "zod";
1363
+
1364
+ // src/lib/react-core.ts
1365
+ import { CopilotKitCore } from "@copilotkitnext/core";
1299
1366
  var CopilotKitCoreReact = class extends CopilotKitCore {
1300
1367
  _renderToolCalls = [];
1301
1368
  _renderCustomMessages = [];
@@ -1334,26 +1401,33 @@ var CopilotKitCoreReact = class extends CopilotKitCore {
1334
1401
  subscribe(subscriber) {
1335
1402
  return super.subscribe(subscriber);
1336
1403
  }
1337
- unsubscribe(subscriber) {
1338
- super.unsubscribe(subscriber);
1339
- }
1340
1404
  };
1405
+
1406
+ // src/components/CopilotKitInspector.tsx
1407
+ import * as React4 from "react";
1408
+ import { createComponent } from "@lit-labs/react";
1409
+ import {
1410
+ WEB_INSPECTOR_TAG,
1411
+ WebInspectorElement,
1412
+ defineWebInspector
1413
+ } from "@copilotkitnext/web-inspector";
1414
+ import { jsx as jsx7 } from "react/jsx-runtime";
1341
1415
  defineWebInspector();
1342
1416
  var CopilotKitInspectorBase = createComponent({
1343
1417
  tagName: WEB_INSPECTOR_TAG,
1344
1418
  elementClass: WebInspectorElement,
1345
- react: React2
1419
+ react: React4
1346
1420
  });
1347
- var CopilotKitInspector = React2.forwardRef(
1421
+ var CopilotKitInspector = React4.forwardRef(
1348
1422
  ({ core, ...rest }, ref) => {
1349
- const innerRef = React2.useRef(null);
1350
- React2.useImperativeHandle(ref, () => innerRef.current, []);
1351
- React2.useEffect(() => {
1423
+ const innerRef = React4.useRef(null);
1424
+ React4.useImperativeHandle(ref, () => innerRef.current, []);
1425
+ React4.useEffect(() => {
1352
1426
  if (innerRef.current) {
1353
1427
  innerRef.current.core = core ?? null;
1354
1428
  }
1355
1429
  }, [core]);
1356
- return /* @__PURE__ */ jsx(
1430
+ return /* @__PURE__ */ jsx7(
1357
1431
  CopilotKitInspectorBase,
1358
1432
  {
1359
1433
  ...rest,
@@ -1363,14 +1437,17 @@ var CopilotKitInspector = React2.forwardRef(
1363
1437
  }
1364
1438
  );
1365
1439
  CopilotKitInspector.displayName = "CopilotKitInspector";
1366
- var CopilotKitContext = createContext({
1440
+
1441
+ // src/providers/CopilotKitProvider.tsx
1442
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
1443
+ var CopilotKitContext = createContext2({
1367
1444
  copilotkit: null
1368
1445
  });
1369
1446
  function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
1370
- const empty = useMemo(() => [], []);
1447
+ const empty = useMemo3(() => [], []);
1371
1448
  const value = prop ?? empty;
1372
- const initial = useRef(value);
1373
- useEffect(() => {
1449
+ const initial = useRef4(value);
1450
+ useEffect4(() => {
1374
1451
  if (warningMessage && value !== initial.current && (isMeaningfulChange ? isMeaningfulChange(initial.current, value) : true)) {
1375
1452
  console.error(warningMessage);
1376
1453
  }
@@ -1391,8 +1468,8 @@ var CopilotKitProvider = ({
1391
1468
  showDevConsole = false,
1392
1469
  useSingleEndpoint = false
1393
1470
  }) => {
1394
- const [shouldRenderInspector, setShouldRenderInspector] = useState(false);
1395
- useEffect(() => {
1471
+ const [shouldRenderInspector, setShouldRenderInspector] = useState3(false);
1472
+ useEffect4(() => {
1396
1473
  if (typeof window === "undefined") {
1397
1474
  return;
1398
1475
  }
@@ -1438,7 +1515,7 @@ var CopilotKitProvider = ({
1438
1515
  humanInTheLoop,
1439
1516
  "humanInTheLoop must be a stable array. If you want to dynamically add or remove human-in-the-loop tools, use `useHumanInTheLoop` instead."
1440
1517
  );
1441
- const processedHumanInTheLoopTools = useMemo(() => {
1518
+ const processedHumanInTheLoopTools = useMemo3(() => {
1442
1519
  const processedTools = [];
1443
1520
  const processedRenderToolCalls = [];
1444
1521
  humanInTheLoopList.forEach((tool) => {
@@ -1467,13 +1544,13 @@ var CopilotKitProvider = ({
1467
1544
  });
1468
1545
  return { tools: processedTools, renderToolCalls: processedRenderToolCalls };
1469
1546
  }, [humanInTheLoopList]);
1470
- const allTools = useMemo(() => {
1547
+ const allTools = useMemo3(() => {
1471
1548
  const tools = [];
1472
1549
  tools.push(...frontendToolsList);
1473
1550
  tools.push(...processedHumanInTheLoopTools.tools);
1474
1551
  return tools;
1475
1552
  }, [frontendToolsList, processedHumanInTheLoopTools]);
1476
- const allRenderToolCalls = useMemo(() => {
1553
+ const allRenderToolCalls = useMemo3(() => {
1477
1554
  const combined = [...renderToolCallsList];
1478
1555
  frontendToolsList.forEach((tool) => {
1479
1556
  if (tool.render) {
@@ -1490,7 +1567,7 @@ var CopilotKitProvider = ({
1490
1567
  combined.push(...processedHumanInTheLoopTools.renderToolCalls);
1491
1568
  return combined;
1492
1569
  }, [renderToolCallsList, frontendToolsList, processedHumanInTheLoopTools]);
1493
- const copilotkit = useMemo(() => {
1570
+ const copilotkit = useMemo3(() => {
1494
1571
  const copilotkit2 = new CopilotKitCoreReact({
1495
1572
  runtimeUrl,
1496
1573
  runtimeTransport: useSingleEndpoint ? "single" : "rest",
@@ -1505,24 +1582,24 @@ var CopilotKitProvider = ({
1505
1582
  return copilotkit2;
1506
1583
  }, [allTools, allRenderToolCalls, renderActivityMessagesList, renderCustomMessagesList, useSingleEndpoint]);
1507
1584
  const [, forceUpdate] = useReducer((x) => x + 1, 0);
1508
- useEffect(() => {
1509
- const unsubscribe = copilotkit.subscribe({
1585
+ useEffect4(() => {
1586
+ const subscription = copilotkit.subscribe({
1510
1587
  onRenderToolCallsChanged: () => {
1511
1588
  forceUpdate();
1512
1589
  }
1513
1590
  });
1514
1591
  return () => {
1515
- unsubscribe();
1592
+ subscription.unsubscribe();
1516
1593
  };
1517
1594
  }, [copilotkit]);
1518
- useEffect(() => {
1595
+ useEffect4(() => {
1519
1596
  copilotkit.setRuntimeUrl(runtimeUrl);
1520
1597
  copilotkit.setRuntimeTransport(useSingleEndpoint ? "single" : "rest");
1521
1598
  copilotkit.setHeaders(headers);
1522
1599
  copilotkit.setProperties(properties);
1523
1600
  copilotkit.setAgents__unsafe_dev_only(agents);
1524
1601
  }, [runtimeUrl, headers, properties, agents, useSingleEndpoint]);
1525
- return /* @__PURE__ */ jsxs(
1602
+ return /* @__PURE__ */ jsxs4(
1526
1603
  CopilotKitContext.Provider,
1527
1604
  {
1528
1605
  value: {
@@ -1530,45 +1607,50 @@ var CopilotKitProvider = ({
1530
1607
  },
1531
1608
  children: [
1532
1609
  children,
1533
- shouldRenderInspector ? /* @__PURE__ */ jsx(CopilotKitInspector, { core: copilotkit }) : null
1610
+ shouldRenderInspector ? /* @__PURE__ */ jsx8(CopilotKitInspector, { core: copilotkit }) : null
1534
1611
  ]
1535
1612
  }
1536
1613
  );
1537
1614
  };
1538
1615
  var useCopilotKit = () => {
1539
- const context = useContext(CopilotKitContext);
1616
+ const context = useContext2(CopilotKitContext);
1540
1617
  const [, forceUpdate] = useReducer((x) => x + 1, 0);
1541
1618
  if (!context) {
1542
1619
  throw new Error("useCopilotKit must be used within CopilotKitProvider");
1543
1620
  }
1544
- useEffect(() => {
1545
- const unsubscribe = context.copilotkit.subscribe({
1621
+ useEffect4(() => {
1622
+ const subscription = context.copilotkit.subscribe({
1546
1623
  onRuntimeConnectionStatusChanged: () => {
1547
1624
  forceUpdate();
1548
1625
  }
1549
1626
  });
1550
1627
  return () => {
1551
- unsubscribe();
1628
+ subscription.unsubscribe();
1552
1629
  };
1553
1630
  }, []);
1554
1631
  return context;
1555
1632
  };
1633
+
1634
+ // src/hooks/use-render-tool-call.tsx
1635
+ import { DEFAULT_AGENT_ID as DEFAULT_AGENT_ID2 } from "@copilotkitnext/shared";
1636
+ import { partialJSONParse } from "@copilotkitnext/shared";
1637
+ import { jsx as jsx9 } from "react/jsx-runtime";
1556
1638
  function useRenderToolCall() {
1557
1639
  const { copilotkit } = useCopilotKit();
1558
1640
  const config = useCopilotChatConfiguration();
1559
- const agentId = config?.agentId ?? DEFAULT_AGENT_ID;
1560
- const [executingToolCallIds, setExecutingToolCallIds] = useState(() => /* @__PURE__ */ new Set());
1641
+ const agentId = config?.agentId ?? DEFAULT_AGENT_ID2;
1642
+ const [executingToolCallIds, setExecutingToolCallIds] = useState4(() => /* @__PURE__ */ new Set());
1561
1643
  const renderToolCalls = useSyncExternalStore(
1562
1644
  (callback) => {
1563
1645
  return copilotkit.subscribe({
1564
1646
  onRenderToolCallsChanged: callback
1565
- });
1647
+ }).unsubscribe;
1566
1648
  },
1567
1649
  () => copilotkit.renderToolCalls,
1568
1650
  () => copilotkit.renderToolCalls
1569
1651
  );
1570
- useEffect(() => {
1571
- const unsubscribe = copilotkit.subscribe({
1652
+ useEffect5(() => {
1653
+ const subscription = copilotkit.subscribe({
1572
1654
  onToolExecutionStart: ({ toolCallId }) => {
1573
1655
  setExecutingToolCallIds((prev) => {
1574
1656
  if (prev.has(toolCallId)) return prev;
@@ -1586,9 +1668,9 @@ function useRenderToolCall() {
1586
1668
  });
1587
1669
  }
1588
1670
  });
1589
- return () => unsubscribe();
1671
+ return () => subscription.unsubscribe();
1590
1672
  }, [copilotkit]);
1591
- const renderToolCall = useCallback(
1673
+ const renderToolCall = useCallback2(
1592
1674
  ({
1593
1675
  toolCall,
1594
1676
  toolMessage
@@ -1604,7 +1686,7 @@ function useRenderToolCall() {
1604
1686
  const args = partialJSONParse(toolCall.function.arguments);
1605
1687
  const toolName = toolCall.function.name;
1606
1688
  if (toolMessage) {
1607
- return /* @__PURE__ */ jsx(
1689
+ return /* @__PURE__ */ jsx9(
1608
1690
  RenderComponent,
1609
1691
  {
1610
1692
  name: toolName,
@@ -1615,7 +1697,7 @@ function useRenderToolCall() {
1615
1697
  toolCall.id
1616
1698
  );
1617
1699
  } else if (executingToolCallIds.has(toolCall.id)) {
1618
- return /* @__PURE__ */ jsx(
1700
+ return /* @__PURE__ */ jsx9(
1619
1701
  RenderComponent,
1620
1702
  {
1621
1703
  name: toolName,
@@ -1626,7 +1708,7 @@ function useRenderToolCall() {
1626
1708
  toolCall.id
1627
1709
  );
1628
1710
  } else {
1629
- return /* @__PURE__ */ jsx(
1711
+ return /* @__PURE__ */ jsx9(
1630
1712
  RenderComponent,
1631
1713
  {
1632
1714
  name: toolName,
@@ -1642,6 +1724,9 @@ function useRenderToolCall() {
1642
1724
  );
1643
1725
  return renderToolCall;
1644
1726
  }
1727
+
1728
+ // src/hooks/use-render-custom-messages.tsx
1729
+ import { jsx as jsx10 } from "react/jsx-runtime";
1645
1730
  function useRenderCustomMessages() {
1646
1731
  const { copilotkit } = useCopilotKit();
1647
1732
  const config = useCopilotChatConfiguration();
@@ -1676,7 +1761,7 @@ function useRenderCustomMessages() {
1676
1761
  continue;
1677
1762
  }
1678
1763
  const Component = renderer.render;
1679
- result = /* @__PURE__ */ jsx(
1764
+ result = /* @__PURE__ */ jsx10(
1680
1765
  Component,
1681
1766
  {
1682
1767
  message,
@@ -1697,12 +1782,17 @@ function useRenderCustomMessages() {
1697
1782
  return result;
1698
1783
  };
1699
1784
  }
1785
+
1786
+ // src/hooks/use-render-activity-message.tsx
1787
+ import { DEFAULT_AGENT_ID as DEFAULT_AGENT_ID3 } from "@copilotkitnext/shared";
1788
+ import { useCallback as useCallback3 } from "react";
1789
+ import { jsx as jsx11 } from "react/jsx-runtime";
1700
1790
  function useRenderActivityMessage() {
1701
1791
  const { copilotkit } = useCopilotKit();
1702
1792
  const config = useCopilotChatConfiguration();
1703
- const agentId = config?.agentId ?? DEFAULT_AGENT_ID;
1793
+ const agentId = config?.agentId ?? DEFAULT_AGENT_ID3;
1704
1794
  const renderers = copilotkit.renderActivityMessages;
1705
- return useCallback(
1795
+ return useCallback3(
1706
1796
  (message) => {
1707
1797
  if (!renderers.length) {
1708
1798
  return null;
@@ -1724,7 +1814,7 @@ function useRenderActivityMessage() {
1724
1814
  }
1725
1815
  const Component = renderer.render;
1726
1816
  const agent = copilotkit.getAgent(agentId);
1727
- return /* @__PURE__ */ jsx(
1817
+ return /* @__PURE__ */ jsx11(
1728
1818
  Component,
1729
1819
  {
1730
1820
  activityType: message.activityType,
@@ -1738,9 +1828,12 @@ function useRenderActivityMessage() {
1738
1828
  [agentId, copilotkit, renderers]
1739
1829
  );
1740
1830
  }
1831
+
1832
+ // src/hooks/use-frontend-tool.tsx
1833
+ import { useEffect as useEffect6 } from "react";
1741
1834
  function useFrontendTool(tool) {
1742
1835
  const { copilotkit } = useCopilotKit();
1743
- useEffect(() => {
1836
+ useEffect6(() => {
1744
1837
  const name = tool.name;
1745
1838
  if (copilotkit.getTool({ toolName: name, agentId: tool.agentId })) {
1746
1839
  console.warn(
@@ -1770,21 +1863,25 @@ function useFrontendTool(tool) {
1770
1863
  };
1771
1864
  }, [tool.name, copilotkit]);
1772
1865
  }
1866
+
1867
+ // src/hooks/use-human-in-the-loop.tsx
1868
+ import { useCallback as useCallback4, useRef as useRef5, useEffect as useEffect7 } from "react";
1869
+ import React7 from "react";
1773
1870
  function useHumanInTheLoop(tool) {
1774
1871
  const { copilotkit } = useCopilotKit();
1775
- const resolvePromiseRef = useRef(null);
1776
- const respond = useCallback(async (result) => {
1872
+ const resolvePromiseRef = useRef5(null);
1873
+ const respond = useCallback4(async (result) => {
1777
1874
  if (resolvePromiseRef.current) {
1778
1875
  resolvePromiseRef.current(result);
1779
1876
  resolvePromiseRef.current = null;
1780
1877
  }
1781
1878
  }, []);
1782
- const handler = useCallback(async () => {
1879
+ const handler = useCallback4(async () => {
1783
1880
  return new Promise((resolve) => {
1784
1881
  resolvePromiseRef.current = resolve;
1785
1882
  });
1786
1883
  }, []);
1787
- const RenderComponent = useCallback(
1884
+ const RenderComponent = useCallback4(
1788
1885
  (props) => {
1789
1886
  const ToolComponent = tool.render;
1790
1887
  if (props.status === "inProgress") {
@@ -1794,7 +1891,7 @@ function useHumanInTheLoop(tool) {
1794
1891
  description: tool.description || "",
1795
1892
  respond: void 0
1796
1893
  };
1797
- return React2__default.createElement(ToolComponent, enhancedProps);
1894
+ return React7.createElement(ToolComponent, enhancedProps);
1798
1895
  } else if (props.status === "executing") {
1799
1896
  const enhancedProps = {
1800
1897
  ...props,
@@ -1802,7 +1899,7 @@ function useHumanInTheLoop(tool) {
1802
1899
  description: tool.description || "",
1803
1900
  respond
1804
1901
  };
1805
- return React2__default.createElement(ToolComponent, enhancedProps);
1902
+ return React7.createElement(ToolComponent, enhancedProps);
1806
1903
  } else if (props.status === "complete") {
1807
1904
  const enhancedProps = {
1808
1905
  ...props,
@@ -1810,9 +1907,9 @@ function useHumanInTheLoop(tool) {
1810
1907
  description: tool.description || "",
1811
1908
  respond: void 0
1812
1909
  };
1813
- return React2__default.createElement(ToolComponent, enhancedProps);
1910
+ return React7.createElement(ToolComponent, enhancedProps);
1814
1911
  }
1815
- return React2__default.createElement(ToolComponent, props);
1912
+ return React7.createElement(ToolComponent, props);
1816
1913
  },
1817
1914
  [tool.render, tool.name, tool.description, respond]
1818
1915
  );
@@ -1822,7 +1919,7 @@ function useHumanInTheLoop(tool) {
1822
1919
  render: RenderComponent
1823
1920
  };
1824
1921
  useFrontendTool(frontendTool);
1825
- useEffect(() => {
1922
+ useEffect7(() => {
1826
1923
  return () => {
1827
1924
  const keyOf = (rc) => `${rc.agentId ?? ""}:${rc.name}`;
1828
1925
  const currentRenderToolCalls = copilotkit.renderToolCalls;
@@ -1833,31 +1930,55 @@ function useHumanInTheLoop(tool) {
1833
1930
  };
1834
1931
  }, [copilotkit, tool.name, tool.agentId]);
1835
1932
  }
1933
+
1934
+ // src/hooks/use-agent.tsx
1935
+ import { useMemo as useMemo4, useEffect as useEffect8, useReducer as useReducer2 } from "react";
1936
+ import { DEFAULT_AGENT_ID as DEFAULT_AGENT_ID4 } from "@copilotkitnext/shared";
1937
+ import { ProxiedCopilotRuntimeAgent, CopilotKitCoreRuntimeConnectionStatus } from "@copilotkitnext/core";
1836
1938
  var ALL_UPDATES = [
1837
1939
  "OnMessagesChanged" /* OnMessagesChanged */,
1838
1940
  "OnStateChanged" /* OnStateChanged */,
1839
1941
  "OnRunStatusChanged" /* OnRunStatusChanged */
1840
1942
  ];
1841
1943
  function useAgent({ agentId, updates } = {}) {
1842
- agentId ??= DEFAULT_AGENT_ID;
1944
+ agentId ??= DEFAULT_AGENT_ID4;
1843
1945
  const { copilotkit } = useCopilotKit();
1844
- const [, forceUpdate] = useReducer((x) => x + 1, 0);
1845
- const updateFlags = useMemo(
1946
+ const [, forceUpdate] = useReducer2((x) => x + 1, 0);
1947
+ const updateFlags = useMemo4(
1846
1948
  () => updates ?? ALL_UPDATES,
1847
1949
  [JSON.stringify(updates)]
1848
1950
  );
1849
- const agent = useMemo(() => {
1850
- return copilotkit.getAgent(agentId);
1951
+ const agent = useMemo4(() => {
1952
+ const existing = copilotkit.getAgent(agentId);
1953
+ if (existing) {
1954
+ return existing;
1955
+ }
1956
+ const isRuntimeConfigured = copilotkit.runtimeUrl !== void 0;
1957
+ const status = copilotkit.runtimeConnectionStatus;
1958
+ if (isRuntimeConfigured && (status === CopilotKitCoreRuntimeConnectionStatus.Disconnected || status === CopilotKitCoreRuntimeConnectionStatus.Connecting)) {
1959
+ const provisional = new ProxiedCopilotRuntimeAgent({
1960
+ runtimeUrl: copilotkit.runtimeUrl,
1961
+ agentId,
1962
+ transport: copilotkit.runtimeTransport
1963
+ });
1964
+ provisional.headers = { ...copilotkit.headers };
1965
+ return provisional;
1966
+ }
1967
+ const knownAgents = Object.keys(copilotkit.agents ?? {});
1968
+ const runtimePart = isRuntimeConfigured ? `runtimeUrl=${copilotkit.runtimeUrl}` : "no runtimeUrl";
1969
+ throw new Error(
1970
+ `useAgent: Agent '${agentId}' not found after runtime sync (${runtimePart}). ` + (knownAgents.length ? `Known agents: [${knownAgents.join(", ")}]` : "No agents registered.") + " Verify your runtime /info and/or agents__unsafe_dev_only."
1971
+ );
1851
1972
  }, [
1852
1973
  agentId,
1853
1974
  copilotkit.agents,
1854
1975
  copilotkit.runtimeConnectionStatus,
1976
+ copilotkit.runtimeUrl,
1977
+ copilotkit.runtimeTransport,
1978
+ JSON.stringify(copilotkit.headers),
1855
1979
  copilotkit
1856
1980
  ]);
1857
- useEffect(() => {
1858
- if (!agent) {
1859
- return;
1860
- }
1981
+ useEffect8(() => {
1861
1982
  if (updateFlags.length === 0) {
1862
1983
  return;
1863
1984
  }
@@ -1890,10 +2011,13 @@ function useAgent({ agentId, updates } = {}) {
1890
2011
  agent
1891
2012
  };
1892
2013
  }
2014
+
2015
+ // src/hooks/use-agent-context.tsx
2016
+ import { useEffect as useEffect9 } from "react";
1893
2017
  function useAgentContext(context) {
1894
2018
  const { description, value } = context;
1895
2019
  const { copilotkit } = useCopilotKit();
1896
- useEffect(() => {
2020
+ useEffect9(() => {
1897
2021
  if (!copilotkit) return;
1898
2022
  const id = copilotkit.addContext(context);
1899
2023
  return () => {
@@ -1901,25 +2025,29 @@ function useAgentContext(context) {
1901
2025
  };
1902
2026
  }, [description, value, copilotkit]);
1903
2027
  }
2028
+
2029
+ // src/hooks/use-suggestions.tsx
2030
+ import { useCallback as useCallback5, useEffect as useEffect10, useMemo as useMemo5, useState as useState5 } from "react";
2031
+ import { DEFAULT_AGENT_ID as DEFAULT_AGENT_ID5 } from "@copilotkitnext/shared";
1904
2032
  function useSuggestions({ agentId } = {}) {
1905
2033
  const { copilotkit } = useCopilotKit();
1906
2034
  const config = useCopilotChatConfiguration();
1907
- const resolvedAgentId = useMemo(() => agentId ?? config?.agentId ?? DEFAULT_AGENT_ID, [agentId, config?.agentId]);
1908
- const [suggestions, setSuggestions] = useState(() => {
2035
+ const resolvedAgentId = useMemo5(() => agentId ?? config?.agentId ?? DEFAULT_AGENT_ID5, [agentId, config?.agentId]);
2036
+ const [suggestions, setSuggestions] = useState5(() => {
1909
2037
  const result = copilotkit.getSuggestions(resolvedAgentId);
1910
2038
  return result.suggestions;
1911
2039
  });
1912
- const [isLoading, setIsLoading] = useState(() => {
2040
+ const [isLoading, setIsLoading] = useState5(() => {
1913
2041
  const result = copilotkit.getSuggestions(resolvedAgentId);
1914
2042
  return result.isLoading;
1915
2043
  });
1916
- useEffect(() => {
2044
+ useEffect10(() => {
1917
2045
  const result = copilotkit.getSuggestions(resolvedAgentId);
1918
2046
  setSuggestions(result.suggestions);
1919
2047
  setIsLoading(result.isLoading);
1920
2048
  }, [copilotkit, resolvedAgentId]);
1921
- useEffect(() => {
1922
- const unsubscribe = copilotkit.subscribe({
2049
+ useEffect10(() => {
2050
+ const subscription = copilotkit.subscribe({
1923
2051
  onSuggestionsChanged: ({ agentId: changedAgentId, suggestions: suggestions2 }) => {
1924
2052
  if (changedAgentId !== resolvedAgentId) {
1925
2053
  return;
@@ -1945,13 +2073,13 @@ function useSuggestions({ agentId } = {}) {
1945
2073
  }
1946
2074
  });
1947
2075
  return () => {
1948
- unsubscribe();
2076
+ subscription.unsubscribe();
1949
2077
  };
1950
2078
  }, [copilotkit, resolvedAgentId]);
1951
- const reloadSuggestions = useCallback(() => {
2079
+ const reloadSuggestions = useCallback5(() => {
1952
2080
  copilotkit.reloadSuggestions(resolvedAgentId);
1953
2081
  }, [copilotkit, resolvedAgentId]);
1954
- const clearSuggestions = useCallback(() => {
2082
+ const clearSuggestions = useCallback5(() => {
1955
2083
  copilotkit.clearSuggestions(resolvedAgentId);
1956
2084
  }, [copilotkit, resolvedAgentId]);
1957
2085
  return {
@@ -1961,18 +2089,22 @@ function useSuggestions({ agentId } = {}) {
1961
2089
  isLoading
1962
2090
  };
1963
2091
  }
2092
+
2093
+ // src/hooks/use-configure-suggestions.tsx
2094
+ import { useCallback as useCallback6, useEffect as useEffect11, useMemo as useMemo6, useRef as useRef6 } from "react";
2095
+ import { DEFAULT_AGENT_ID as DEFAULT_AGENT_ID6 } from "@copilotkitnext/shared";
1964
2096
  var EMPTY_DEPS = [];
1965
2097
  function useConfigureSuggestions(config, options) {
1966
2098
  const { copilotkit } = useCopilotKit();
1967
2099
  const chatConfig = useCopilotChatConfiguration();
1968
2100
  const extraDeps = options?.deps ?? EMPTY_DEPS;
1969
- const resolvedConsumerAgentId = useMemo(() => chatConfig?.agentId ?? DEFAULT_AGENT_ID, [chatConfig?.agentId]);
1970
- const rawConsumerAgentId = useMemo(() => config ? config.consumerAgentId : void 0, [config]);
1971
- const normalizationCacheRef = useRef({
2101
+ const resolvedConsumerAgentId = useMemo6(() => chatConfig?.agentId ?? DEFAULT_AGENT_ID6, [chatConfig?.agentId]);
2102
+ const rawConsumerAgentId = useMemo6(() => config ? config.consumerAgentId : void 0, [config]);
2103
+ const normalizationCacheRef = useRef6({
1972
2104
  serialized: null,
1973
2105
  config: null
1974
2106
  });
1975
- const { normalizedConfig, serializedConfig } = useMemo(() => {
2107
+ const { normalizedConfig, serializedConfig } = useMemo6(() => {
1976
2108
  if (!config) {
1977
2109
  normalizationCacheRef.current = { serialized: null, config: null };
1978
2110
  return { normalizedConfig: null, serializedConfig: null };
@@ -2002,10 +2134,10 @@ function useConfigureSuggestions(config, options) {
2002
2134
  normalizationCacheRef.current = { serialized, config: built };
2003
2135
  return { normalizedConfig: built, serializedConfig: serialized };
2004
2136
  }, [config, resolvedConsumerAgentId, ...extraDeps]);
2005
- const latestConfigRef = useRef(null);
2137
+ const latestConfigRef = useRef6(null);
2006
2138
  latestConfigRef.current = normalizedConfig;
2007
- const previousSerializedConfigRef = useRef(null);
2008
- const targetAgentId = useMemo(() => {
2139
+ const previousSerializedConfigRef = useRef6(null);
2140
+ const targetAgentId = useMemo6(() => {
2009
2141
  if (!normalizedConfig) {
2010
2142
  return resolvedConsumerAgentId;
2011
2143
  }
@@ -2016,7 +2148,7 @@ function useConfigureSuggestions(config, options) {
2016
2148
  return consumer;
2017
2149
  }, [normalizedConfig, resolvedConsumerAgentId]);
2018
2150
  const isGlobalConfig = rawConsumerAgentId === void 0 || rawConsumerAgentId === "*";
2019
- const requestReload = useCallback(() => {
2151
+ const requestReload = useCallback6(() => {
2020
2152
  if (!normalizedConfig) {
2021
2153
  return;
2022
2154
  }
@@ -2038,7 +2170,7 @@ function useConfigureSuggestions(config, options) {
2038
2170
  }
2039
2171
  copilotkit.reloadSuggestions(targetAgentId);
2040
2172
  }, [copilotkit, isGlobalConfig, normalizedConfig, targetAgentId]);
2041
- useEffect(() => {
2173
+ useEffect11(() => {
2042
2174
  if (!serializedConfig || !latestConfigRef.current) {
2043
2175
  return;
2044
2176
  }
@@ -2048,7 +2180,7 @@ function useConfigureSuggestions(config, options) {
2048
2180
  copilotkit.removeSuggestionsConfig(id);
2049
2181
  };
2050
2182
  }, [copilotkit, serializedConfig, requestReload]);
2051
- useEffect(() => {
2183
+ useEffect11(() => {
2052
2184
  if (!normalizedConfig) {
2053
2185
  previousSerializedConfigRef.current = null;
2054
2186
  return;
@@ -2061,7 +2193,7 @@ function useConfigureSuggestions(config, options) {
2061
2193
  }
2062
2194
  requestReload();
2063
2195
  }, [normalizedConfig, requestReload, serializedConfig]);
2064
- useEffect(() => {
2196
+ useEffect11(() => {
2065
2197
  if (!normalizedConfig || extraDeps.length === 0) {
2066
2198
  return;
2067
2199
  }
@@ -2077,6 +2209,10 @@ function normalizeStaticSuggestions(suggestions) {
2077
2209
  isLoading: suggestion.isLoading ?? false
2078
2210
  }));
2079
2211
  }
2212
+
2213
+ // src/components/chat/CopilotChatToolCallsView.tsx
2214
+ import React8 from "react";
2215
+ import { Fragment as Fragment2, jsx as jsx12 } from "react/jsx-runtime";
2080
2216
  function CopilotChatToolCallsView({
2081
2217
  message,
2082
2218
  messages = []
@@ -2085,17 +2221,20 @@ function CopilotChatToolCallsView({
2085
2221
  if (!message.toolCalls || message.toolCalls.length === 0) {
2086
2222
  return null;
2087
2223
  }
2088
- return /* @__PURE__ */ jsx(Fragment, { children: message.toolCalls.map((toolCall) => {
2224
+ return /* @__PURE__ */ jsx12(Fragment2, { children: message.toolCalls.map((toolCall) => {
2089
2225
  const toolMessage = messages.find(
2090
2226
  (m) => m.role === "tool" && m.toolCallId === toolCall.id
2091
2227
  );
2092
- return /* @__PURE__ */ jsx(React2__default.Fragment, { children: renderToolCall({
2228
+ return /* @__PURE__ */ jsx12(React8.Fragment, { children: renderToolCall({
2093
2229
  toolCall,
2094
2230
  toolMessage
2095
2231
  }) }, toolCall.id);
2096
2232
  }) });
2097
2233
  }
2098
2234
  var CopilotChatToolCallsView_default = CopilotChatToolCallsView;
2235
+
2236
+ // src/components/chat/CopilotChatAssistantMessage.tsx
2237
+ import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
2099
2238
  function CopilotChatAssistantMessage({
2100
2239
  message,
2101
2240
  messages,
@@ -2172,7 +2311,7 @@ function CopilotChatAssistantMessage({
2172
2311
  toolbar,
2173
2312
  CopilotChatAssistantMessage.Toolbar,
2174
2313
  {
2175
- children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
2314
+ children: /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1", children: [
2176
2315
  boundCopyButton,
2177
2316
  (onThumbsUp || thumbsUpButton) && boundThumbsUpButton,
2178
2317
  (onThumbsDown || thumbsDownButton) && boundThumbsDownButton,
@@ -2194,7 +2333,7 @@ function CopilotChatAssistantMessage({
2194
2333
  const isLatestAssistantMessage = message.role === "assistant" && messages?.[messages.length - 1]?.id === message.id;
2195
2334
  const shouldShowToolbar = toolbarVisible && hasContent && !(isRunning && isLatestAssistantMessage);
2196
2335
  if (children) {
2197
- return /* @__PURE__ */ jsx(Fragment, { children: children({
2336
+ return /* @__PURE__ */ jsx13(Fragment3, { children: children({
2198
2337
  markdownRenderer: boundMarkdownRenderer,
2199
2338
  toolbar: boundToolbar,
2200
2339
  toolCallsView: boundToolCallsView,
@@ -2214,10 +2353,10 @@ function CopilotChatAssistantMessage({
2214
2353
  toolbarVisible: shouldShowToolbar
2215
2354
  }) });
2216
2355
  }
2217
- return /* @__PURE__ */ jsxs(
2356
+ return /* @__PURE__ */ jsxs5(
2218
2357
  "div",
2219
2358
  {
2220
- className: twMerge(
2359
+ className: twMerge4(
2221
2360
  "prose max-w-full break-words dark:prose-invert",
2222
2361
  className
2223
2362
  ),
@@ -2232,14 +2371,14 @@ function CopilotChatAssistantMessage({
2232
2371
  );
2233
2372
  }
2234
2373
  ((CopilotChatAssistantMessage2) => {
2235
- CopilotChatAssistantMessage2.MarkdownRenderer = ({ content, className, ...props }) => /* @__PURE__ */ jsx(Streamdown, { className, ...props, children: content ?? "" });
2374
+ CopilotChatAssistantMessage2.MarkdownRenderer = ({ content, className, ...props }) => /* @__PURE__ */ jsx13(Streamdown, { className, ...props, children: content ?? "" });
2236
2375
  CopilotChatAssistantMessage2.Toolbar = ({
2237
2376
  className,
2238
2377
  ...props
2239
- }) => /* @__PURE__ */ jsx(
2378
+ }) => /* @__PURE__ */ jsx13(
2240
2379
  "div",
2241
2380
  {
2242
- className: twMerge(
2381
+ className: twMerge4(
2243
2382
  "w-full bg-transparent flex items-center -ml-[5px] -mt-[0px]",
2244
2383
  className
2245
2384
  ),
@@ -2247,8 +2386,8 @@ function CopilotChatAssistantMessage({
2247
2386
  }
2248
2387
  );
2249
2388
  CopilotChatAssistantMessage2.ToolbarButton = ({ title, children, ...props }) => {
2250
- return /* @__PURE__ */ jsxs(Tooltip, { children: [
2251
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
2389
+ return /* @__PURE__ */ jsxs5(Tooltip, { children: [
2390
+ /* @__PURE__ */ jsx13(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx13(
2252
2391
  Button,
2253
2392
  {
2254
2393
  type: "button",
@@ -2258,13 +2397,13 @@ function CopilotChatAssistantMessage({
2258
2397
  children
2259
2398
  }
2260
2399
  ) }),
2261
- /* @__PURE__ */ jsx(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsx("p", { children: title }) })
2400
+ /* @__PURE__ */ jsx13(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsx13("p", { children: title }) })
2262
2401
  ] });
2263
2402
  };
2264
2403
  CopilotChatAssistantMessage2.CopyButton = ({ className, title, onClick, ...props }) => {
2265
2404
  const config = useCopilotChatConfiguration();
2266
2405
  const labels = config?.labels ?? CopilotChatDefaultLabels;
2267
- const [copied, setCopied] = useState(false);
2406
+ const [copied, setCopied] = useState6(false);
2268
2407
  const handleClick = (event) => {
2269
2408
  setCopied(true);
2270
2409
  setTimeout(() => setCopied(false), 2e3);
@@ -2272,62 +2411,62 @@ function CopilotChatAssistantMessage({
2272
2411
  onClick(event);
2273
2412
  }
2274
2413
  };
2275
- return /* @__PURE__ */ jsx(
2414
+ return /* @__PURE__ */ jsx13(
2276
2415
  CopilotChatAssistantMessage2.ToolbarButton,
2277
2416
  {
2278
2417
  title: title || labels.assistantMessageToolbarCopyMessageLabel,
2279
2418
  onClick: handleClick,
2280
2419
  className,
2281
2420
  ...props,
2282
- children: copied ? /* @__PURE__ */ jsx(Check, { className: "size-[18px]" }) : /* @__PURE__ */ jsx(Copy, { className: "size-[18px]" })
2421
+ children: copied ? /* @__PURE__ */ jsx13(Check2, { className: "size-[18px]" }) : /* @__PURE__ */ jsx13(Copy, { className: "size-[18px]" })
2283
2422
  }
2284
2423
  );
2285
2424
  };
2286
2425
  CopilotChatAssistantMessage2.ThumbsUpButton = ({ title, ...props }) => {
2287
2426
  const config = useCopilotChatConfiguration();
2288
2427
  const labels = config?.labels ?? CopilotChatDefaultLabels;
2289
- return /* @__PURE__ */ jsx(
2428
+ return /* @__PURE__ */ jsx13(
2290
2429
  CopilotChatAssistantMessage2.ToolbarButton,
2291
2430
  {
2292
2431
  title: title || labels.assistantMessageToolbarThumbsUpLabel,
2293
2432
  ...props,
2294
- children: /* @__PURE__ */ jsx(ThumbsUp, { className: "size-[18px]" })
2433
+ children: /* @__PURE__ */ jsx13(ThumbsUp, { className: "size-[18px]" })
2295
2434
  }
2296
2435
  );
2297
2436
  };
2298
2437
  CopilotChatAssistantMessage2.ThumbsDownButton = ({ title, ...props }) => {
2299
2438
  const config = useCopilotChatConfiguration();
2300
2439
  const labels = config?.labels ?? CopilotChatDefaultLabels;
2301
- return /* @__PURE__ */ jsx(
2440
+ return /* @__PURE__ */ jsx13(
2302
2441
  CopilotChatAssistantMessage2.ToolbarButton,
2303
2442
  {
2304
2443
  title: title || labels.assistantMessageToolbarThumbsDownLabel,
2305
2444
  ...props,
2306
- children: /* @__PURE__ */ jsx(ThumbsDown, { className: "size-[18px]" })
2445
+ children: /* @__PURE__ */ jsx13(ThumbsDown, { className: "size-[18px]" })
2307
2446
  }
2308
2447
  );
2309
2448
  };
2310
2449
  CopilotChatAssistantMessage2.ReadAloudButton = ({ title, ...props }) => {
2311
2450
  const config = useCopilotChatConfiguration();
2312
2451
  const labels = config?.labels ?? CopilotChatDefaultLabels;
2313
- return /* @__PURE__ */ jsx(
2452
+ return /* @__PURE__ */ jsx13(
2314
2453
  CopilotChatAssistantMessage2.ToolbarButton,
2315
2454
  {
2316
2455
  title: title || labels.assistantMessageToolbarReadAloudLabel,
2317
2456
  ...props,
2318
- children: /* @__PURE__ */ jsx(Volume2, { className: "size-[20px]" })
2457
+ children: /* @__PURE__ */ jsx13(Volume2, { className: "size-[20px]" })
2319
2458
  }
2320
2459
  );
2321
2460
  };
2322
2461
  CopilotChatAssistantMessage2.RegenerateButton = ({ title, ...props }) => {
2323
2462
  const config = useCopilotChatConfiguration();
2324
2463
  const labels = config?.labels ?? CopilotChatDefaultLabels;
2325
- return /* @__PURE__ */ jsx(
2464
+ return /* @__PURE__ */ jsx13(
2326
2465
  CopilotChatAssistantMessage2.ToolbarButton,
2327
2466
  {
2328
2467
  title: title || labels.assistantMessageToolbarRegenerateLabel,
2329
2468
  ...props,
2330
- children: /* @__PURE__ */ jsx(RefreshCw, { className: "size-[18px]" })
2469
+ children: /* @__PURE__ */ jsx13(RefreshCw, { className: "size-[18px]" })
2331
2470
  }
2332
2471
  );
2333
2472
  };
@@ -2340,6 +2479,12 @@ CopilotChatAssistantMessage.ThumbsDownButton.displayName = "CopilotChatAssistant
2340
2479
  CopilotChatAssistantMessage.ReadAloudButton.displayName = "CopilotChatAssistantMessage.ReadAloudButton";
2341
2480
  CopilotChatAssistantMessage.RegenerateButton.displayName = "CopilotChatAssistantMessage.RegenerateButton";
2342
2481
  var CopilotChatAssistantMessage_default = CopilotChatAssistantMessage;
2482
+
2483
+ // src/components/chat/CopilotChatUserMessage.tsx
2484
+ import { useMemo as useMemo7, useState as useState7 } from "react";
2485
+ import { Copy as Copy2, Check as Check3, Edit, ChevronLeft, ChevronRight } from "lucide-react";
2486
+ import { twMerge as twMerge5 } from "tailwind-merge";
2487
+ import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
2343
2488
  function flattenUserMessageContent(content) {
2344
2489
  if (!content) {
2345
2490
  return "";
@@ -2370,7 +2515,7 @@ function CopilotChatUserMessage({
2370
2515
  className,
2371
2516
  ...props
2372
2517
  }) {
2373
- const flattenedContent = useMemo(
2518
+ const flattenedContent = useMemo7(
2374
2519
  () => flattenUserMessageContent(message.content),
2375
2520
  [message.content]
2376
2521
  );
@@ -2415,7 +2560,7 @@ function CopilotChatUserMessage({
2415
2560
  );
2416
2561
  const showBranchNavigation = numberOfBranches && numberOfBranches > 1 && onSwitchToBranch;
2417
2562
  const BoundToolbar = renderSlot(toolbar, CopilotChatUserMessage.Toolbar, {
2418
- children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 justify-end", children: [
2563
+ children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1 justify-end", children: [
2419
2564
  additionalToolbarItems,
2420
2565
  BoundCopyButton,
2421
2566
  onEditMessage && BoundEditButton,
@@ -2423,7 +2568,7 @@ function CopilotChatUserMessage({
2423
2568
  ] })
2424
2569
  });
2425
2570
  if (children) {
2426
- return /* @__PURE__ */ jsx(Fragment, { children: children({
2571
+ return /* @__PURE__ */ jsx14(Fragment4, { children: children({
2427
2572
  messageRenderer: BoundMessageRenderer,
2428
2573
  toolbar: BoundToolbar,
2429
2574
  copyButton: BoundCopyButton,
@@ -2435,10 +2580,10 @@ function CopilotChatUserMessage({
2435
2580
  additionalToolbarItems
2436
2581
  }) });
2437
2582
  }
2438
- return /* @__PURE__ */ jsxs(
2583
+ return /* @__PURE__ */ jsxs6(
2439
2584
  "div",
2440
2585
  {
2441
- className: twMerge("flex flex-col items-end group pt-10", className),
2586
+ className: twMerge5("flex flex-col items-end group pt-10", className),
2442
2587
  "data-message-id": message.id,
2443
2588
  ...props,
2444
2589
  children: [
@@ -2449,18 +2594,18 @@ function CopilotChatUserMessage({
2449
2594
  );
2450
2595
  }
2451
2596
  ((CopilotChatUserMessage2) => {
2452
- CopilotChatUserMessage2.Container = ({ children, className, ...props }) => /* @__PURE__ */ jsx(
2597
+ CopilotChatUserMessage2.Container = ({ children, className, ...props }) => /* @__PURE__ */ jsx14(
2453
2598
  "div",
2454
2599
  {
2455
- className: twMerge("flex flex-col items-end group", className),
2600
+ className: twMerge5("flex flex-col items-end group", className),
2456
2601
  ...props,
2457
2602
  children
2458
2603
  }
2459
2604
  );
2460
- CopilotChatUserMessage2.MessageRenderer = ({ content, className }) => /* @__PURE__ */ jsx(
2605
+ CopilotChatUserMessage2.MessageRenderer = ({ content, className }) => /* @__PURE__ */ jsx14(
2461
2606
  "div",
2462
2607
  {
2463
- className: twMerge(
2608
+ className: twMerge5(
2464
2609
  "prose dark:prose-invert bg-muted relative max-w-[80%] rounded-[18px] px-4 py-1.5 data-[multiline]:py-3 inline-block whitespace-pre-wrap",
2465
2610
  className
2466
2611
  ),
@@ -2470,10 +2615,10 @@ function CopilotChatUserMessage({
2470
2615
  CopilotChatUserMessage2.Toolbar = ({
2471
2616
  className,
2472
2617
  ...props
2473
- }) => /* @__PURE__ */ jsx(
2618
+ }) => /* @__PURE__ */ jsx14(
2474
2619
  "div",
2475
2620
  {
2476
- className: twMerge(
2621
+ className: twMerge5(
2477
2622
  "w-full bg-transparent flex items-center justify-end -mr-[5px] mt-[4px] invisible group-hover:visible",
2478
2623
  className
2479
2624
  ),
@@ -2481,25 +2626,25 @@ function CopilotChatUserMessage({
2481
2626
  }
2482
2627
  );
2483
2628
  CopilotChatUserMessage2.ToolbarButton = ({ title, children, className, ...props }) => {
2484
- return /* @__PURE__ */ jsxs(Tooltip, { children: [
2485
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
2629
+ return /* @__PURE__ */ jsxs6(Tooltip, { children: [
2630
+ /* @__PURE__ */ jsx14(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx14(
2486
2631
  Button,
2487
2632
  {
2488
2633
  type: "button",
2489
2634
  variant: "assistantMessageToolbarButton",
2490
2635
  "aria-label": title,
2491
- className: twMerge(className),
2636
+ className: twMerge5(className),
2492
2637
  ...props,
2493
2638
  children
2494
2639
  }
2495
2640
  ) }),
2496
- /* @__PURE__ */ jsx(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsx("p", { children: title }) })
2641
+ /* @__PURE__ */ jsx14(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsx14("p", { children: title }) })
2497
2642
  ] });
2498
2643
  };
2499
2644
  CopilotChatUserMessage2.CopyButton = ({ className, title, onClick, ...props }) => {
2500
2645
  const config = useCopilotChatConfiguration();
2501
2646
  const labels = config?.labels ?? CopilotChatDefaultLabels;
2502
- const [copied, setCopied] = useState(false);
2647
+ const [copied, setCopied] = useState7(false);
2503
2648
  const handleClick = (event) => {
2504
2649
  setCopied(true);
2505
2650
  setTimeout(() => setCopied(false), 2e3);
@@ -2507,27 +2652,27 @@ function CopilotChatUserMessage({
2507
2652
  onClick(event);
2508
2653
  }
2509
2654
  };
2510
- return /* @__PURE__ */ jsx(
2655
+ return /* @__PURE__ */ jsx14(
2511
2656
  CopilotChatUserMessage2.ToolbarButton,
2512
2657
  {
2513
2658
  title: title || labels.userMessageToolbarCopyMessageLabel,
2514
2659
  onClick: handleClick,
2515
2660
  className,
2516
2661
  ...props,
2517
- children: copied ? /* @__PURE__ */ jsx(Check, { className: "size-[18px]" }) : /* @__PURE__ */ jsx(Copy, { className: "size-[18px]" })
2662
+ children: copied ? /* @__PURE__ */ jsx14(Check3, { className: "size-[18px]" }) : /* @__PURE__ */ jsx14(Copy2, { className: "size-[18px]" })
2518
2663
  }
2519
2664
  );
2520
2665
  };
2521
2666
  CopilotChatUserMessage2.EditButton = ({ className, title, ...props }) => {
2522
2667
  const config = useCopilotChatConfiguration();
2523
2668
  const labels = config?.labels ?? CopilotChatDefaultLabels;
2524
- return /* @__PURE__ */ jsx(
2669
+ return /* @__PURE__ */ jsx14(
2525
2670
  CopilotChatUserMessage2.ToolbarButton,
2526
2671
  {
2527
2672
  title: title || labels.userMessageToolbarEditMessageLabel,
2528
2673
  className,
2529
2674
  ...props,
2530
- children: /* @__PURE__ */ jsx(Edit, { className: "size-[18px]" })
2675
+ children: /* @__PURE__ */ jsx14(Edit, { className: "size-[18px]" })
2531
2676
  }
2532
2677
  );
2533
2678
  };
@@ -2544,8 +2689,8 @@ function CopilotChatUserMessage({
2544
2689
  }
2545
2690
  const canGoPrev = currentBranch > 0;
2546
2691
  const canGoNext = currentBranch < numberOfBranches - 1;
2547
- return /* @__PURE__ */ jsxs("div", { className: twMerge("flex items-center gap-1", className), ...props, children: [
2548
- /* @__PURE__ */ jsx(
2692
+ return /* @__PURE__ */ jsxs6("div", { className: twMerge5("flex items-center gap-1", className), ...props, children: [
2693
+ /* @__PURE__ */ jsx14(
2549
2694
  Button,
2550
2695
  {
2551
2696
  type: "button",
@@ -2557,15 +2702,15 @@ function CopilotChatUserMessage({
2557
2702
  }),
2558
2703
  disabled: !canGoPrev,
2559
2704
  className: "h-6 w-6 p-0",
2560
- children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-[20px]" })
2705
+ children: /* @__PURE__ */ jsx14(ChevronLeft, { className: "size-[20px]" })
2561
2706
  }
2562
2707
  ),
2563
- /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground px-0 font-medium", children: [
2708
+ /* @__PURE__ */ jsxs6("span", { className: "text-sm text-muted-foreground px-0 font-medium", children: [
2564
2709
  currentBranch + 1,
2565
2710
  "/",
2566
2711
  numberOfBranches
2567
2712
  ] }),
2568
- /* @__PURE__ */ jsx(
2713
+ /* @__PURE__ */ jsx14(
2569
2714
  Button,
2570
2715
  {
2571
2716
  type: "button",
@@ -2577,7 +2722,7 @@ function CopilotChatUserMessage({
2577
2722
  }),
2578
2723
  disabled: !canGoNext,
2579
2724
  className: "h-6 w-6 p-0",
2580
- children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-[20px]" })
2725
+ children: /* @__PURE__ */ jsx14(ChevronRight, { className: "size-[20px]" })
2581
2726
  }
2582
2727
  )
2583
2728
  ] });
@@ -2591,11 +2736,16 @@ CopilotChatUserMessage.CopyButton.displayName = "CopilotChatUserMessage.CopyButt
2591
2736
  CopilotChatUserMessage.EditButton.displayName = "CopilotChatUserMessage.EditButton";
2592
2737
  CopilotChatUserMessage.BranchNavigation.displayName = "CopilotChatUserMessage.BranchNavigation";
2593
2738
  var CopilotChatUserMessage_default = CopilotChatUserMessage;
2739
+
2740
+ // src/components/chat/CopilotChatSuggestionPill.tsx
2741
+ import React9 from "react";
2742
+ import { Loader2 } from "lucide-react";
2743
+ import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
2594
2744
  var baseClasses = "group inline-flex h-7 sm:h-8 items-center gap-1 sm:gap-1.5 rounded-full border border-border/60 bg-background px-2.5 sm:px-3 text-[11px] sm:text-xs leading-none text-foreground transition-colors cursor-pointer hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:text-muted-foreground disabled:hover:bg-background disabled:hover:text-muted-foreground pointer-events-auto";
2595
2745
  var labelClasses = "whitespace-nowrap font-medium leading-none";
2596
- var CopilotChatSuggestionPill = React2__default.forwardRef(function CopilotChatSuggestionPill2({ className, children, icon, isLoading, type, ...props }, ref) {
2746
+ var CopilotChatSuggestionPill = React9.forwardRef(function CopilotChatSuggestionPill2({ className, children, icon, isLoading, type, ...props }, ref) {
2597
2747
  const showIcon = !isLoading && icon;
2598
- return /* @__PURE__ */ jsxs(
2748
+ return /* @__PURE__ */ jsxs7(
2599
2749
  "button",
2600
2750
  {
2601
2751
  ref,
@@ -2606,16 +2756,20 @@ var CopilotChatSuggestionPill = React2__default.forwardRef(function CopilotChatS
2606
2756
  disabled: isLoading || props.disabled,
2607
2757
  ...props,
2608
2758
  children: [
2609
- isLoading ? /* @__PURE__ */ jsx("span", { className: "flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ jsx(Loader2, { className: "h-3.5 sm:h-4 w-3.5 sm:w-4 animate-spin", "aria-hidden": "true" }) }) : showIcon && /* @__PURE__ */ jsx("span", { className: "flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground", children: icon }),
2610
- /* @__PURE__ */ jsx("span", { className: labelClasses, children })
2759
+ isLoading ? /* @__PURE__ */ jsx15("span", { className: "flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ jsx15(Loader2, { className: "h-3.5 sm:h-4 w-3.5 sm:w-4 animate-spin", "aria-hidden": "true" }) }) : showIcon && /* @__PURE__ */ jsx15("span", { className: "flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground", children: icon }),
2760
+ /* @__PURE__ */ jsx15("span", { className: labelClasses, children })
2611
2761
  ]
2612
2762
  }
2613
2763
  );
2614
2764
  });
2615
2765
  CopilotChatSuggestionPill.displayName = "CopilotChatSuggestionPill";
2616
2766
  var CopilotChatSuggestionPill_default = CopilotChatSuggestionPill;
2617
- var DefaultContainer = React2__default.forwardRef(function DefaultContainer2({ className, ...props }, ref) {
2618
- return /* @__PURE__ */ jsx(
2767
+
2768
+ // src/components/chat/CopilotChatSuggestionView.tsx
2769
+ import React10 from "react";
2770
+ import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
2771
+ var DefaultContainer = React10.forwardRef(function DefaultContainer2({ className, ...props }, ref) {
2772
+ return /* @__PURE__ */ jsx16(
2619
2773
  "div",
2620
2774
  {
2621
2775
  ref,
@@ -2627,7 +2781,7 @@ var DefaultContainer = React2__default.forwardRef(function DefaultContainer2({ c
2627
2781
  }
2628
2782
  );
2629
2783
  });
2630
- var CopilotChatSuggestionView = React2__default.forwardRef(function CopilotChatSuggestionView2({
2784
+ var CopilotChatSuggestionView = React10.forwardRef(function CopilotChatSuggestionView2({
2631
2785
  suggestions,
2632
2786
  onSelectSuggestion,
2633
2787
  loadingIndexes,
@@ -2637,7 +2791,7 @@ var CopilotChatSuggestionView = React2__default.forwardRef(function CopilotChatS
2637
2791
  children,
2638
2792
  ...restProps
2639
2793
  }, ref) {
2640
- const loadingSet = React2__default.useMemo(() => {
2794
+ const loadingSet = React10.useMemo(() => {
2641
2795
  if (!loadingIndexes || loadingIndexes.length === 0) {
2642
2796
  return /* @__PURE__ */ new Set();
2643
2797
  }
@@ -2656,11 +2810,11 @@ var CopilotChatSuggestionView = React2__default.forwardRef(function CopilotChatS
2656
2810
  type: "button",
2657
2811
  onClick: () => onSelectSuggestion?.(suggestion, index)
2658
2812
  });
2659
- return React2__default.cloneElement(pill, {
2813
+ return React10.cloneElement(pill, {
2660
2814
  key: `${suggestion.title}-${index}`
2661
2815
  });
2662
2816
  });
2663
- const boundContainer = React2__default.cloneElement(
2817
+ const boundContainer = React10.cloneElement(
2664
2818
  ContainerElement,
2665
2819
  void 0,
2666
2820
  suggestionElements
@@ -2671,7 +2825,7 @@ var CopilotChatSuggestionView = React2__default.forwardRef(function CopilotChatS
2671
2825
  isLoading: suggestions.length > 0 ? loadingSet.has(0) || suggestions[0]?.isLoading === true : false,
2672
2826
  type: "button"
2673
2827
  });
2674
- return /* @__PURE__ */ jsx(Fragment, { children: children({
2828
+ return /* @__PURE__ */ jsx16(Fragment5, { children: children({
2675
2829
  container: boundContainer,
2676
2830
  suggestion: sampleSuggestion,
2677
2831
  suggestions,
@@ -2682,7 +2836,7 @@ var CopilotChatSuggestionView = React2__default.forwardRef(function CopilotChatS
2682
2836
  }) });
2683
2837
  }
2684
2838
  if (children) {
2685
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2839
+ return /* @__PURE__ */ jsxs8(Fragment5, { children: [
2686
2840
  boundContainer,
2687
2841
  children
2688
2842
  ] });
@@ -2691,6 +2845,10 @@ var CopilotChatSuggestionView = React2__default.forwardRef(function CopilotChatS
2691
2845
  });
2692
2846
  CopilotChatSuggestionView.displayName = "CopilotChatSuggestionView";
2693
2847
  var CopilotChatSuggestionView_default = CopilotChatSuggestionView;
2848
+
2849
+ // src/components/chat/CopilotChatMessageView.tsx
2850
+ import { twMerge as twMerge6 } from "tailwind-merge";
2851
+ import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
2694
2852
  function CopilotChatMessageView({
2695
2853
  messages = [],
2696
2854
  assistantMessage,
@@ -2748,29 +2906,38 @@ function CopilotChatMessageView({
2748
2906
  if (children) {
2749
2907
  return children({ messageElements, messages, isRunning });
2750
2908
  }
2751
- return /* @__PURE__ */ jsxs("div", { className: twMerge("flex flex-col", className), ...props, children: [
2909
+ return /* @__PURE__ */ jsxs9("div", { className: twMerge6("flex flex-col", className), ...props, children: [
2752
2910
  messageElements,
2753
2911
  isRunning && renderSlot(cursor, CopilotChatMessageView.Cursor, {})
2754
2912
  ] });
2755
2913
  }
2756
2914
  CopilotChatMessageView.Cursor = function Cursor({ className, ...props }) {
2757
- return /* @__PURE__ */ jsx(
2915
+ return /* @__PURE__ */ jsx17(
2758
2916
  "div",
2759
2917
  {
2760
- className: twMerge("w-[11px] h-[11px] rounded-full bg-foreground animate-pulse-cursor ml-1", className),
2918
+ className: twMerge6("w-[11px] h-[11px] rounded-full bg-foreground animate-pulse-cursor ml-1", className),
2761
2919
  ...props
2762
2920
  }
2763
2921
  );
2764
2922
  };
2765
2923
  var CopilotChatMessageView_default = CopilotChatMessageView;
2924
+
2925
+ // src/components/chat/CopilotChatView.tsx
2926
+ import React11, { useRef as useRef7, useState as useState9, useEffect as useEffect13 } from "react";
2927
+ import { twMerge as twMerge7 } from "tailwind-merge";
2928
+ import { StickToBottom, useStickToBottom, useStickToBottomContext } from "use-stick-to-bottom";
2929
+ import { ChevronDown } from "lucide-react";
2930
+
2931
+ // src/hooks/use-keyboard-height.tsx
2932
+ import { useState as useState8, useEffect as useEffect12 } from "react";
2766
2933
  function useKeyboardHeight() {
2767
- const [keyboardState, setKeyboardState] = useState({
2934
+ const [keyboardState, setKeyboardState] = useState8({
2768
2935
  isKeyboardOpen: false,
2769
2936
  keyboardHeight: 0,
2770
2937
  availableHeight: typeof window !== "undefined" ? window.innerHeight : 0,
2771
2938
  viewportHeight: typeof window !== "undefined" ? window.innerHeight : 0
2772
2939
  });
2773
- useEffect(() => {
2940
+ useEffect12(() => {
2774
2941
  if (typeof window === "undefined") {
2775
2942
  return;
2776
2943
  }
@@ -2800,6 +2967,9 @@ function useKeyboardHeight() {
2800
2967
  }, []);
2801
2968
  return keyboardState;
2802
2969
  }
2970
+
2971
+ // src/components/chat/CopilotChatView.tsx
2972
+ import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
2803
2973
  function CopilotChatView({
2804
2974
  messageView,
2805
2975
  input,
@@ -2820,12 +2990,12 @@ function CopilotChatView({
2820
2990
  className,
2821
2991
  ...props
2822
2992
  }) {
2823
- const inputContainerRef = useRef(null);
2824
- const [inputContainerHeight, setInputContainerHeight] = useState(0);
2825
- const [isResizing, setIsResizing] = useState(false);
2826
- const resizeTimeoutRef = useRef(null);
2993
+ const inputContainerRef = useRef7(null);
2994
+ const [inputContainerHeight, setInputContainerHeight] = useState9(0);
2995
+ const [isResizing, setIsResizing] = useState9(false);
2996
+ const resizeTimeoutRef = useRef7(null);
2827
2997
  const { isKeyboardOpen, keyboardHeight, availableHeight } = useKeyboardHeight();
2828
- useEffect(() => {
2998
+ useEffect13(() => {
2829
2999
  const element = inputContainerRef.current;
2830
3000
  if (!element) return;
2831
3001
  const resizeObserver = new ResizeObserver((entries) => {
@@ -2877,9 +3047,9 @@ function CopilotChatView({
2877
3047
  scrollToBottomButton,
2878
3048
  inputContainerHeight,
2879
3049
  isResizing,
2880
- children: /* @__PURE__ */ jsx("div", { style: { paddingBottom: `${inputContainerHeight + (hasSuggestions ? 4 : 32)}px` }, children: /* @__PURE__ */ jsxs("div", { className: "max-w-3xl mx-auto", children: [
3050
+ children: /* @__PURE__ */ jsx18("div", { style: { paddingBottom: `${inputContainerHeight + (hasSuggestions ? 4 : 32)}px` }, children: /* @__PURE__ */ jsxs10("div", { className: "max-w-3xl mx-auto", children: [
2881
3051
  BoundMessageView,
2882
- hasSuggestions ? /* @__PURE__ */ jsx("div", { className: "pl-0 pr-4 sm:px-0 mt-4", children: BoundSuggestionView }) : null
3052
+ hasSuggestions ? /* @__PURE__ */ jsx18("div", { className: "pl-0 pr-4 sm:px-0 mt-4", children: BoundSuggestionView }) : null
2883
3053
  ] }) })
2884
3054
  });
2885
3055
  const BoundScrollToBottomButton = renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, {});
@@ -2887,8 +3057,8 @@ function CopilotChatView({
2887
3057
  const BoundInputContainer = renderSlot(inputContainer, CopilotChatView.InputContainer, {
2888
3058
  ref: inputContainerRef,
2889
3059
  keyboardHeight: isKeyboardOpen ? keyboardHeight : 0,
2890
- children: /* @__PURE__ */ jsxs(Fragment, { children: [
2891
- /* @__PURE__ */ jsx("div", { className: "max-w-3xl mx-auto py-0 px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6 pointer-events-auto", children: BoundInput }),
3060
+ children: /* @__PURE__ */ jsxs10(Fragment6, { children: [
3061
+ /* @__PURE__ */ jsx18("div", { className: "max-w-3xl mx-auto py-0 px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6 pointer-events-auto", children: BoundInput }),
2892
3062
  BoundDisclaimer
2893
3063
  ] })
2894
3064
  });
@@ -2901,10 +3071,10 @@ function CopilotChatView({
2901
3071
  feather: BoundFeather,
2902
3072
  inputContainer: BoundInputContainer,
2903
3073
  disclaimer: BoundDisclaimer,
2904
- suggestionView: BoundSuggestionView ?? /* @__PURE__ */ jsx(Fragment, {})
3074
+ suggestionView: BoundSuggestionView ?? /* @__PURE__ */ jsx18(Fragment6, {})
2905
3075
  });
2906
3076
  }
2907
- return /* @__PURE__ */ jsxs("div", { className: twMerge("relative h-full", className), ...props, children: [
3077
+ return /* @__PURE__ */ jsxs10("div", { className: twMerge7("relative h-full", className), ...props, children: [
2908
3078
  BoundScrollView,
2909
3079
  BoundFeather,
2910
3080
  BoundInputContainer
@@ -2913,9 +3083,9 @@ function CopilotChatView({
2913
3083
  ((CopilotChatView2) => {
2914
3084
  const ScrollContent = ({ children, scrollToBottomButton, inputContainerHeight, isResizing }) => {
2915
3085
  const { isAtBottom, scrollToBottom } = useStickToBottomContext();
2916
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2917
- /* @__PURE__ */ jsx(StickToBottom.Content, { className: "overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ jsx("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6", children }) }),
2918
- !isAtBottom && !isResizing && /* @__PURE__ */ jsx(
3086
+ return /* @__PURE__ */ jsxs10(Fragment6, { children: [
3087
+ /* @__PURE__ */ jsx18(StickToBottom.Content, { className: "overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ jsx18("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6", children }) }),
3088
+ !isAtBottom && !isResizing && /* @__PURE__ */ jsx18(
2919
3089
  "div",
2920
3090
  {
2921
3091
  className: "absolute inset-x-0 flex justify-center z-10 pointer-events-none",
@@ -2938,13 +3108,13 @@ function CopilotChatView({
2938
3108
  className,
2939
3109
  ...props
2940
3110
  }) => {
2941
- const [hasMounted, setHasMounted] = useState(false);
3111
+ const [hasMounted, setHasMounted] = useState9(false);
2942
3112
  const { scrollRef, contentRef, scrollToBottom } = useStickToBottom();
2943
- const [showScrollButton, setShowScrollButton] = useState(false);
2944
- useEffect(() => {
3113
+ const [showScrollButton, setShowScrollButton] = useState9(false);
3114
+ useEffect13(() => {
2945
3115
  setHasMounted(true);
2946
3116
  }, []);
2947
- useEffect(() => {
3117
+ useEffect13(() => {
2948
3118
  if (autoScroll) return;
2949
3119
  const scrollElement = scrollRef.current;
2950
3120
  if (!scrollElement) return;
@@ -2962,10 +3132,10 @@ function CopilotChatView({
2962
3132
  };
2963
3133
  }, [scrollRef, autoScroll]);
2964
3134
  if (!hasMounted) {
2965
- return /* @__PURE__ */ jsx("div", { className: "h-full max-h-full flex flex-col min-h-0 overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ jsx("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6", children }) });
3135
+ return /* @__PURE__ */ jsx18("div", { className: "h-full max-h-full flex flex-col min-h-0 overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ jsx18("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6", children }) });
2966
3136
  }
2967
3137
  if (!autoScroll) {
2968
- return /* @__PURE__ */ jsxs(
3138
+ return /* @__PURE__ */ jsxs10(
2969
3139
  "div",
2970
3140
  {
2971
3141
  ref: scrollRef,
@@ -2975,8 +3145,8 @@ function CopilotChatView({
2975
3145
  ),
2976
3146
  ...props,
2977
3147
  children: [
2978
- /* @__PURE__ */ jsx("div", { ref: contentRef, className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6", children }),
2979
- showScrollButton && !isResizing && /* @__PURE__ */ jsx(
3148
+ /* @__PURE__ */ jsx18("div", { ref: contentRef, className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6", children }),
3149
+ showScrollButton && !isResizing && /* @__PURE__ */ jsx18(
2980
3150
  "div",
2981
3151
  {
2982
3152
  className: "absolute inset-x-0 flex justify-center z-10 pointer-events-none",
@@ -2992,14 +3162,14 @@ function CopilotChatView({
2992
3162
  }
2993
3163
  );
2994
3164
  }
2995
- return /* @__PURE__ */ jsx(
3165
+ return /* @__PURE__ */ jsx18(
2996
3166
  StickToBottom,
2997
3167
  {
2998
3168
  className: cn("h-full max-h-full flex flex-col min-h-0 relative", className),
2999
3169
  resize: "smooth",
3000
3170
  initial: "smooth",
3001
3171
  ...props,
3002
- children: /* @__PURE__ */ jsx(
3172
+ children: /* @__PURE__ */ jsx18(
3003
3173
  ScrollContent,
3004
3174
  {
3005
3175
  scrollToBottomButton,
@@ -3014,12 +3184,12 @@ function CopilotChatView({
3014
3184
  CopilotChatView2.ScrollToBottomButton = ({
3015
3185
  className,
3016
3186
  ...props
3017
- }) => /* @__PURE__ */ jsx(
3187
+ }) => /* @__PURE__ */ jsx18(
3018
3188
  Button,
3019
3189
  {
3020
3190
  variant: "outline",
3021
3191
  size: "sm",
3022
- className: twMerge(
3192
+ className: twMerge7(
3023
3193
  "rounded-full w-10 h-10 p-0 pointer-events-auto",
3024
3194
  "bg-white dark:bg-gray-900",
3025
3195
  "shadow-lg border border-gray-200 dark:border-gray-700",
@@ -3028,10 +3198,10 @@ function CopilotChatView({
3028
3198
  className
3029
3199
  ),
3030
3200
  ...props,
3031
- children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-4 h-4 text-gray-600 dark:text-white" })
3201
+ children: /* @__PURE__ */ jsx18(ChevronDown, { className: "w-4 h-4 text-gray-600 dark:text-white" })
3032
3202
  }
3033
3203
  );
3034
- CopilotChatView2.Feather = ({ className, style, ...props }) => /* @__PURE__ */ jsx(
3204
+ CopilotChatView2.Feather = ({ className, style, ...props }) => /* @__PURE__ */ jsx18(
3035
3205
  "div",
3036
3206
  {
3037
3207
  className: cn(
@@ -3044,7 +3214,7 @@ function CopilotChatView({
3044
3214
  ...props
3045
3215
  }
3046
3216
  );
3047
- CopilotChatView2.InputContainer = React2__default.forwardRef(({ children, className, keyboardHeight = 0, ...props }, ref) => /* @__PURE__ */ jsx(
3217
+ CopilotChatView2.InputContainer = React11.forwardRef(({ children, className, keyboardHeight = 0, ...props }, ref) => /* @__PURE__ */ jsx18(
3048
3218
  "div",
3049
3219
  {
3050
3220
  ref,
@@ -3062,7 +3232,7 @@ function CopilotChatView({
3062
3232
  CopilotChatView2.Disclaimer = ({ className, ...props }) => {
3063
3233
  const config = useCopilotChatConfiguration();
3064
3234
  const labels = config?.labels ?? CopilotChatDefaultLabels;
3065
- return /* @__PURE__ */ jsx(
3235
+ return /* @__PURE__ */ jsx18(
3066
3236
  "div",
3067
3237
  {
3068
3238
  className: cn("text-center text-xs text-muted-foreground py-3 px-4 max-w-3xl mx-auto", className),
@@ -3073,11 +3243,18 @@ function CopilotChatView({
3073
3243
  };
3074
3244
  })(CopilotChatView || (CopilotChatView = {}));
3075
3245
  var CopilotChatView_default = CopilotChatView;
3246
+
3247
+ // src/components/chat/CopilotChat.tsx
3248
+ import { DEFAULT_AGENT_ID as DEFAULT_AGENT_ID7, randomUUID as randomUUID2 } from "@copilotkitnext/shared";
3249
+ import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo8 } from "react";
3250
+ import { merge } from "ts-deepmerge";
3251
+ import { AGUIConnectNotImplementedError } from "@ag-ui/client";
3252
+ import { jsx as jsx19 } from "react/jsx-runtime";
3076
3253
  function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen, ...props }) {
3077
3254
  const existingConfig = useCopilotChatConfiguration();
3078
- const resolvedAgentId = agentId ?? existingConfig?.agentId ?? DEFAULT_AGENT_ID;
3079
- const resolvedThreadId = useMemo(
3080
- () => threadId ?? existingConfig?.threadId ?? randomUUID(),
3255
+ const resolvedAgentId = agentId ?? existingConfig?.agentId ?? DEFAULT_AGENT_ID7;
3256
+ const resolvedThreadId = useMemo8(
3257
+ () => threadId ?? existingConfig?.threadId ?? randomUUID2(),
3081
3258
  [threadId, existingConfig?.threadId]
3082
3259
  );
3083
3260
  const { agent } = useAgent({ agentId: resolvedAgentId });
@@ -3089,47 +3266,41 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
3089
3266
  suggestionView: providedSuggestionView,
3090
3267
  ...restProps
3091
3268
  } = props;
3092
- useEffect(() => {
3269
+ useEffect14(() => {
3093
3270
  const connect = async (agent2) => {
3094
3271
  try {
3095
3272
  await copilotkit.connectAgent({ agent: agent2 });
3096
3273
  } catch (error) {
3097
- if (error instanceof AGUIConnectNotImplementedError) ; else {
3274
+ if (error instanceof AGUIConnectNotImplementedError) {
3275
+ } else {
3098
3276
  throw error;
3099
3277
  }
3100
3278
  }
3101
3279
  };
3102
- if (agent) {
3103
- agent.threadId = resolvedThreadId;
3104
- connect(agent);
3105
- }
3280
+ agent.threadId = resolvedThreadId;
3281
+ connect(agent);
3106
3282
  return () => {
3107
3283
  };
3108
3284
  }, [resolvedThreadId, agent, copilotkit, resolvedAgentId]);
3109
- const onSubmitInput = useCallback(
3285
+ const onSubmitInput = useCallback7(
3110
3286
  async (value) => {
3111
- agent?.addMessage({
3112
- id: randomUUID(),
3287
+ agent.addMessage({
3288
+ id: randomUUID2(),
3113
3289
  role: "user",
3114
3290
  content: value
3115
3291
  });
3116
- if (agent) {
3117
- try {
3118
- await copilotkit.runAgent({ agent });
3119
- } catch (error) {
3120
- console.error("CopilotChat: runAgent failed", error);
3121
- }
3292
+ try {
3293
+ await copilotkit.runAgent({ agent });
3294
+ } catch (error) {
3295
+ console.error("CopilotChat: runAgent failed", error);
3122
3296
  }
3123
3297
  },
3124
3298
  [agent, copilotkit]
3125
3299
  );
3126
- const handleSelectSuggestion = useCallback(
3300
+ const handleSelectSuggestion = useCallback7(
3127
3301
  async (suggestion) => {
3128
- if (!agent) {
3129
- return;
3130
- }
3131
3302
  agent.addMessage({
3132
- id: randomUUID(),
3303
+ id: randomUUID2(),
3133
3304
  role: "user",
3134
3305
  content: suggestion.message
3135
3306
  });
@@ -3141,10 +3312,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
3141
3312
  },
3142
3313
  [agent, copilotkit]
3143
3314
  );
3144
- const stopCurrentRun = useCallback(() => {
3145
- if (!agent) {
3146
- return;
3147
- }
3315
+ const stopCurrentRun = useCallback7(() => {
3148
3316
  try {
3149
3317
  copilotkit.stopAgent({ agent });
3150
3318
  } catch (error) {
@@ -3158,7 +3326,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
3158
3326
  }, [agent, copilotkit]);
3159
3327
  const mergedProps = merge(
3160
3328
  {
3161
- isRunning: agent?.isRunning ?? false,
3329
+ isRunning: agent.isRunning,
3162
3330
  suggestions: autoSuggestions,
3163
3331
  onSelectSuggestion: handleSelectSuggestion,
3164
3332
  suggestionView: providedSuggestionView
@@ -3169,22 +3337,22 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
3169
3337
  }
3170
3338
  );
3171
3339
  const providedStopHandler = providedInputProps?.onStop;
3172
- const hasMessages = (agent?.messages?.length ?? 0) > 0;
3173
- const shouldAllowStop = (agent?.isRunning ?? false) && hasMessages;
3340
+ const hasMessages = agent.messages.length > 0;
3341
+ const shouldAllowStop = agent.isRunning && hasMessages;
3174
3342
  const effectiveStopHandler = shouldAllowStop ? providedStopHandler ?? stopCurrentRun : providedStopHandler;
3175
3343
  const finalInputProps = {
3176
3344
  ...providedInputProps,
3177
3345
  onSubmitMessage: onSubmitInput,
3178
3346
  onStop: effectiveStopHandler,
3179
- isRunning: agent?.isRunning ?? false
3347
+ isRunning: agent.isRunning
3180
3348
  };
3181
- finalInputProps.mode = agent?.isRunning ? "processing" : finalInputProps.mode ?? "input";
3349
+ finalInputProps.mode = agent.isRunning ? "processing" : finalInputProps.mode ?? "input";
3182
3350
  const finalProps = merge(mergedProps, {
3183
- messages: agent?.messages ?? [],
3351
+ messages: agent.messages,
3184
3352
  inputProps: finalInputProps
3185
3353
  });
3186
3354
  const RenderedChatView = renderSlot(chatView, CopilotChatView, finalProps);
3187
- return /* @__PURE__ */ jsx(
3355
+ return /* @__PURE__ */ jsx19(
3188
3356
  CopilotChatConfigurationProvider,
3189
3357
  {
3190
3358
  agentId: resolvedAgentId,
@@ -3198,14 +3366,19 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
3198
3366
  ((CopilotChat2) => {
3199
3367
  CopilotChat2.View = CopilotChatView;
3200
3368
  })(CopilotChat || (CopilotChat = {}));
3369
+
3370
+ // src/components/chat/CopilotChatToggleButton.tsx
3371
+ import React12, { useState as useState10 } from "react";
3372
+ import { MessageCircle, X as X2 } from "lucide-react";
3373
+ import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
3201
3374
  var DefaultOpenIcon = ({
3202
3375
  className,
3203
3376
  ...props
3204
- }) => /* @__PURE__ */ jsx(MessageCircle, { className: cn("h-6 w-6", className), strokeWidth: 1.75, fill: "currentColor", ...props });
3377
+ }) => /* @__PURE__ */ jsx20(MessageCircle, { className: cn("h-6 w-6", className), strokeWidth: 1.75, fill: "currentColor", ...props });
3205
3378
  var DefaultCloseIcon = ({
3206
3379
  className,
3207
3380
  ...props
3208
- }) => /* @__PURE__ */ jsx(X, { className: cn("h-6 w-6", className), strokeWidth: 1.75, ...props });
3381
+ }) => /* @__PURE__ */ jsx20(X2, { className: cn("h-6 w-6", className), strokeWidth: 1.75, ...props });
3209
3382
  DefaultOpenIcon.displayName = "CopilotChatToggleButton.OpenIcon";
3210
3383
  DefaultCloseIcon.displayName = "CopilotChatToggleButton.CloseIcon";
3211
3384
  var ICON_TRANSITION_STYLE = Object.freeze({
@@ -3222,11 +3395,11 @@ var BUTTON_BASE_CLASSES = cn(
3222
3395
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background",
3223
3396
  "disabled:pointer-events-none disabled:opacity-60"
3224
3397
  );
3225
- var CopilotChatToggleButton = React2__default.forwardRef(function CopilotChatToggleButton2({ openIcon, closeIcon, className, ...buttonProps }, ref) {
3398
+ var CopilotChatToggleButton = React12.forwardRef(function CopilotChatToggleButton2({ openIcon, closeIcon, className, ...buttonProps }, ref) {
3226
3399
  const { onClick, type, disabled, ...restProps } = buttonProps;
3227
3400
  const configuration = useCopilotChatConfiguration();
3228
3401
  const labels = configuration?.labels ?? CopilotChatDefaultLabels;
3229
- const [fallbackOpen, setFallbackOpen] = useState(false);
3402
+ const [fallbackOpen, setFallbackOpen] = useState10(false);
3230
3403
  const isOpen = configuration?.isModalOpen ?? fallbackOpen;
3231
3404
  const setModalOpen = configuration?.setModalOpen ?? setFallbackOpen;
3232
3405
  const handleClick = (event) => {
@@ -3260,7 +3433,7 @@ var CopilotChatToggleButton = React2__default.forwardRef(function CopilotChatTog
3260
3433
  focusable: false
3261
3434
  }
3262
3435
  );
3263
- const openIconElement = /* @__PURE__ */ jsx(
3436
+ const openIconElement = /* @__PURE__ */ jsx20(
3264
3437
  "span",
3265
3438
  {
3266
3439
  "aria-hidden": "true",
@@ -3274,7 +3447,7 @@ var CopilotChatToggleButton = React2__default.forwardRef(function CopilotChatTog
3274
3447
  children: renderedOpenIcon
3275
3448
  }
3276
3449
  );
3277
- const closeIconElement = /* @__PURE__ */ jsx(
3450
+ const closeIconElement = /* @__PURE__ */ jsx20(
3278
3451
  "span",
3279
3452
  {
3280
3453
  "aria-hidden": "true",
@@ -3288,7 +3461,7 @@ var CopilotChatToggleButton = React2__default.forwardRef(function CopilotChatTog
3288
3461
  children: renderedCloseIcon
3289
3462
  }
3290
3463
  );
3291
- return /* @__PURE__ */ jsxs(
3464
+ return /* @__PURE__ */ jsxs11(
3292
3465
  "button",
3293
3466
  {
3294
3467
  ref,
@@ -3310,6 +3483,14 @@ var CopilotChatToggleButton = React2__default.forwardRef(function CopilotChatTog
3310
3483
  });
3311
3484
  CopilotChatToggleButton.displayName = "CopilotChatToggleButton";
3312
3485
  var CopilotChatToggleButton_default = CopilotChatToggleButton;
3486
+
3487
+ // src/components/chat/CopilotSidebarView.tsx
3488
+ import { useEffect as useEffect15, useRef as useRef8, useState as useState11 } from "react";
3489
+
3490
+ // src/components/chat/CopilotModalHeader.tsx
3491
+ import { useCallback as useCallback8 } from "react";
3492
+ import { X as X3 } from "lucide-react";
3493
+ import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
3313
3494
  function CopilotModalHeader({
3314
3495
  title,
3315
3496
  titleContent,
@@ -3321,7 +3502,7 @@ function CopilotModalHeader({
3321
3502
  const configuration = useCopilotChatConfiguration();
3322
3503
  const fallbackTitle = configuration?.labels.modalHeaderTitle ?? CopilotChatDefaultLabels.modalHeaderTitle;
3323
3504
  const resolvedTitle = title ?? fallbackTitle;
3324
- const handleClose = useCallback(() => {
3505
+ const handleClose = useCallback8(() => {
3325
3506
  configuration?.setModalOpen(false);
3326
3507
  }, [configuration]);
3327
3508
  const BoundTitle = renderSlot(titleContent, CopilotModalHeader.Title, {
@@ -3338,7 +3519,7 @@ function CopilotModalHeader({
3338
3519
  ...rest
3339
3520
  });
3340
3521
  }
3341
- return /* @__PURE__ */ jsx(
3522
+ return /* @__PURE__ */ jsx21(
3342
3523
  "header",
3343
3524
  {
3344
3525
  "data-slot": "copilot-modal-header",
@@ -3348,17 +3529,17 @@ function CopilotModalHeader({
3348
3529
  className
3349
3530
  ),
3350
3531
  ...rest,
3351
- children: /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center gap-2", children: [
3352
- /* @__PURE__ */ jsx("div", { className: "flex-1", "aria-hidden": "true" }),
3353
- /* @__PURE__ */ jsx("div", { className: "flex flex-1 justify-center text-center", children: BoundTitle }),
3354
- /* @__PURE__ */ jsx("div", { className: "flex flex-1 justify-end", children: BoundCloseButton })
3532
+ children: /* @__PURE__ */ jsxs12("div", { className: "flex w-full items-center gap-2", children: [
3533
+ /* @__PURE__ */ jsx21("div", { className: "flex-1", "aria-hidden": "true" }),
3534
+ /* @__PURE__ */ jsx21("div", { className: "flex flex-1 justify-center text-center", children: BoundTitle }),
3535
+ /* @__PURE__ */ jsx21("div", { className: "flex flex-1 justify-end", children: BoundCloseButton })
3355
3536
  ] })
3356
3537
  }
3357
3538
  );
3358
3539
  }
3359
3540
  CopilotModalHeader.displayName = "CopilotModalHeader";
3360
3541
  ((CopilotModalHeader2) => {
3361
- CopilotModalHeader2.Title = ({ children, className, ...props }) => /* @__PURE__ */ jsx(
3542
+ CopilotModalHeader2.Title = ({ children, className, ...props }) => /* @__PURE__ */ jsx21(
3362
3543
  "div",
3363
3544
  {
3364
3545
  className: cn(
@@ -3372,7 +3553,7 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
3372
3553
  CopilotModalHeader2.CloseButton = ({
3373
3554
  className,
3374
3555
  ...props
3375
- }) => /* @__PURE__ */ jsx(
3556
+ }) => /* @__PURE__ */ jsx21(
3376
3557
  "button",
3377
3558
  {
3378
3559
  type: "button",
@@ -3383,19 +3564,22 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
3383
3564
  ),
3384
3565
  "aria-label": "Close",
3385
3566
  ...props,
3386
- children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4", "aria-hidden": "true" })
3567
+ children: /* @__PURE__ */ jsx21(X3, { className: "h-4 w-4", "aria-hidden": "true" })
3387
3568
  }
3388
3569
  );
3389
3570
  })(CopilotModalHeader || (CopilotModalHeader = {}));
3390
3571
  CopilotModalHeader.Title.displayName = "CopilotModalHeader.Title";
3391
3572
  CopilotModalHeader.CloseButton.displayName = "CopilotModalHeader.CloseButton";
3573
+
3574
+ // src/components/chat/CopilotSidebarView.tsx
3575
+ import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
3392
3576
  var DEFAULT_SIDEBAR_WIDTH = 480;
3393
3577
  var SIDEBAR_TRANSITION_MS = 260;
3394
3578
  function CopilotSidebarView({ header, width, ...props }) {
3395
3579
  const configuration = useCopilotChatConfiguration();
3396
3580
  const isSidebarOpen = configuration?.isModalOpen ?? false;
3397
- const sidebarRef = useRef(null);
3398
- const [sidebarWidth, setSidebarWidth] = useState(width ?? DEFAULT_SIDEBAR_WIDTH);
3581
+ const sidebarRef = useRef8(null);
3582
+ const [sidebarWidth, setSidebarWidth] = useState11(width ?? DEFAULT_SIDEBAR_WIDTH);
3399
3583
  const widthToCss = (w) => {
3400
3584
  return typeof w === "number" ? `${w}px` : w;
3401
3585
  };
@@ -3405,7 +3589,7 @@ function CopilotSidebarView({ header, width, ...props }) {
3405
3589
  }
3406
3590
  return w;
3407
3591
  };
3408
- useEffect(() => {
3592
+ useEffect15(() => {
3409
3593
  if (width !== void 0) {
3410
3594
  return;
3411
3595
  }
@@ -3432,8 +3616,8 @@ function CopilotSidebarView({ header, width, ...props }) {
3432
3616
  return () => window.removeEventListener("resize", updateWidth);
3433
3617
  }, [width]);
3434
3618
  const headerElement = renderSlot(header, CopilotModalHeader, {});
3435
- return /* @__PURE__ */ jsxs(Fragment, { children: [
3436
- isSidebarOpen && /* @__PURE__ */ jsx(
3619
+ return /* @__PURE__ */ jsxs13(Fragment7, { children: [
3620
+ isSidebarOpen && /* @__PURE__ */ jsx22(
3437
3621
  "style",
3438
3622
  {
3439
3623
  dangerouslySetInnerHTML: {
@@ -3447,8 +3631,8 @@ function CopilotSidebarView({ header, width, ...props }) {
3447
3631
  }
3448
3632
  }
3449
3633
  ),
3450
- /* @__PURE__ */ jsx(CopilotChatToggleButton_default, {}),
3451
- /* @__PURE__ */ jsx(
3634
+ /* @__PURE__ */ jsx22(CopilotChatToggleButton_default, {}),
3635
+ /* @__PURE__ */ jsx22(
3452
3636
  "aside",
3453
3637
  {
3454
3638
  ref: sidebarRef,
@@ -3473,15 +3657,19 @@ function CopilotSidebarView({ header, width, ...props }) {
3473
3657
  "aria-hidden": !isSidebarOpen,
3474
3658
  "aria-label": "Copilot chat sidebar",
3475
3659
  role: "complementary",
3476
- children: /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col overflow-hidden", children: [
3660
+ children: /* @__PURE__ */ jsxs13("div", { className: "flex h-full w-full flex-col overflow-hidden", children: [
3477
3661
  headerElement,
3478
- /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-hidden", "data-sidebar-chat": true, children: /* @__PURE__ */ jsx(CopilotChatView_default, { ...props }) })
3662
+ /* @__PURE__ */ jsx22("div", { className: "flex-1 overflow-hidden", "data-sidebar-chat": true, children: /* @__PURE__ */ jsx22(CopilotChatView_default, { ...props }) })
3479
3663
  ] })
3480
3664
  }
3481
3665
  )
3482
3666
  ] });
3483
3667
  }
3484
3668
  CopilotSidebarView.displayName = "CopilotSidebarView";
3669
+
3670
+ // src/components/chat/CopilotPopupView.tsx
3671
+ import { useEffect as useEffect16, useMemo as useMemo9, useRef as useRef9, useState as useState12 } from "react";
3672
+ import { Fragment as Fragment8, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
3485
3673
  var DEFAULT_POPUP_WIDTH = 420;
3486
3674
  var DEFAULT_POPUP_HEIGHT = 560;
3487
3675
  var dimensionToCss = (value, fallback) => {
@@ -3505,10 +3693,10 @@ function CopilotPopupView({
3505
3693
  const isPopupOpen = configuration?.isModalOpen ?? false;
3506
3694
  const setModalOpen = configuration?.setModalOpen;
3507
3695
  const labels = configuration?.labels ?? CopilotChatDefaultLabels;
3508
- const containerRef = useRef(null);
3509
- const [isRendered, setIsRendered] = useState(isPopupOpen);
3510
- const [isAnimatingOut, setIsAnimatingOut] = useState(false);
3511
- useEffect(() => {
3696
+ const containerRef = useRef9(null);
3697
+ const [isRendered, setIsRendered] = useState12(isPopupOpen);
3698
+ const [isAnimatingOut, setIsAnimatingOut] = useState12(false);
3699
+ useEffect16(() => {
3512
3700
  if (isPopupOpen) {
3513
3701
  setIsRendered(true);
3514
3702
  setIsAnimatingOut(false);
@@ -3524,7 +3712,7 @@ function CopilotPopupView({
3524
3712
  }, 200);
3525
3713
  return () => clearTimeout(timeout);
3526
3714
  }, [isPopupOpen, isRendered]);
3527
- useEffect(() => {
3715
+ useEffect16(() => {
3528
3716
  if (!isPopupOpen) {
3529
3717
  return;
3530
3718
  }
@@ -3540,7 +3728,7 @@ function CopilotPopupView({
3540
3728
  window.addEventListener("keydown", handleKeyDown);
3541
3729
  return () => window.removeEventListener("keydown", handleKeyDown);
3542
3730
  }, [isPopupOpen, setModalOpen]);
3543
- useEffect(() => {
3731
+ useEffect16(() => {
3544
3732
  if (!isPopupOpen) {
3545
3733
  return;
3546
3734
  }
@@ -3549,7 +3737,7 @@ function CopilotPopupView({
3549
3737
  }, 200);
3550
3738
  return () => clearTimeout(focusTimer);
3551
3739
  }, [isPopupOpen]);
3552
- useEffect(() => {
3740
+ useEffect16(() => {
3553
3741
  if (!isPopupOpen || !clickOutsideToClose) {
3554
3742
  return;
3555
3743
  }
@@ -3574,10 +3762,10 @@ function CopilotPopupView({
3574
3762
  document.addEventListener("pointerdown", handlePointerDown);
3575
3763
  return () => document.removeEventListener("pointerdown", handlePointerDown);
3576
3764
  }, [isPopupOpen, clickOutsideToClose, setModalOpen]);
3577
- const headerElement = useMemo(() => renderSlot(header, CopilotModalHeader, {}), [header]);
3765
+ const headerElement = useMemo9(() => renderSlot(header, CopilotModalHeader, {}), [header]);
3578
3766
  const resolvedWidth = dimensionToCss(width, DEFAULT_POPUP_WIDTH);
3579
3767
  const resolvedHeight = dimensionToCss(height, DEFAULT_POPUP_HEIGHT);
3580
- const popupStyle = useMemo(
3768
+ const popupStyle = useMemo9(
3581
3769
  () => ({
3582
3770
  "--copilot-popup-width": resolvedWidth,
3583
3771
  "--copilot-popup-height": resolvedHeight,
@@ -3591,14 +3779,14 @@ function CopilotPopupView({
3591
3779
  [resolvedHeight, resolvedWidth]
3592
3780
  );
3593
3781
  const popupAnimationClass = isPopupOpen && !isAnimatingOut ? "pointer-events-auto translate-y-0 opacity-100 md:scale-100" : "pointer-events-none translate-y-4 opacity-0 md:translate-y-5 md:scale-[0.95]";
3594
- const popupContent = isRendered ? /* @__PURE__ */ jsx(
3782
+ const popupContent = isRendered ? /* @__PURE__ */ jsx23(
3595
3783
  "div",
3596
3784
  {
3597
3785
  className: cn(
3598
3786
  "fixed inset-0 z-[1200] flex max-w-full flex-col items-stretch",
3599
3787
  "md:inset-auto md:bottom-24 md:right-6 md:items-end md:gap-4"
3600
3788
  ),
3601
- children: /* @__PURE__ */ jsxs(
3789
+ children: /* @__PURE__ */ jsxs14(
3602
3790
  "div",
3603
3791
  {
3604
3792
  ref: containerRef,
@@ -3619,7 +3807,7 @@ function CopilotPopupView({
3619
3807
  style: popupStyle,
3620
3808
  children: [
3621
3809
  headerElement,
3622
- /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-hidden", "data-popup-chat": true, children: /* @__PURE__ */ jsx(
3810
+ /* @__PURE__ */ jsx23("div", { className: "flex-1 overflow-hidden", "data-popup-chat": true, children: /* @__PURE__ */ jsx23(
3623
3811
  CopilotChatView_default,
3624
3812
  {
3625
3813
  ...restProps,
@@ -3631,17 +3819,21 @@ function CopilotPopupView({
3631
3819
  )
3632
3820
  }
3633
3821
  ) : null;
3634
- return /* @__PURE__ */ jsxs(Fragment, { children: [
3635
- /* @__PURE__ */ jsx(CopilotChatToggleButton_default, {}),
3822
+ return /* @__PURE__ */ jsxs14(Fragment8, { children: [
3823
+ /* @__PURE__ */ jsx23(CopilotChatToggleButton_default, {}),
3636
3824
  popupContent
3637
3825
  ] });
3638
3826
  }
3639
3827
  CopilotPopupView.displayName = "CopilotPopupView";
3828
+
3829
+ // src/components/chat/CopilotSidebar.tsx
3830
+ import { useMemo as useMemo10 } from "react";
3831
+ import { jsx as jsx24 } from "react/jsx-runtime";
3640
3832
  function CopilotSidebar({ header, defaultOpen, width, ...chatProps }) {
3641
- const SidebarViewOverride = useMemo(() => {
3833
+ const SidebarViewOverride = useMemo10(() => {
3642
3834
  const Component = (viewProps) => {
3643
3835
  const { header: viewHeader, width: viewWidth, ...restProps } = viewProps;
3644
- return /* @__PURE__ */ jsx(
3836
+ return /* @__PURE__ */ jsx24(
3645
3837
  CopilotSidebarView,
3646
3838
  {
3647
3839
  ...restProps,
@@ -3652,7 +3844,7 @@ function CopilotSidebar({ header, defaultOpen, width, ...chatProps }) {
3652
3844
  };
3653
3845
  return Object.assign(Component, CopilotChatView_default);
3654
3846
  }, [header, width]);
3655
- return /* @__PURE__ */ jsx(
3847
+ return /* @__PURE__ */ jsx24(
3656
3848
  CopilotChat,
3657
3849
  {
3658
3850
  ...chatProps,
@@ -3662,6 +3854,10 @@ function CopilotSidebar({ header, defaultOpen, width, ...chatProps }) {
3662
3854
  );
3663
3855
  }
3664
3856
  CopilotSidebar.displayName = "CopilotSidebar";
3857
+
3858
+ // src/components/chat/CopilotPopup.tsx
3859
+ import { useMemo as useMemo11 } from "react";
3860
+ import { jsx as jsx25 } from "react/jsx-runtime";
3665
3861
  function CopilotPopup({
3666
3862
  header,
3667
3863
  defaultOpen,
@@ -3670,7 +3866,7 @@ function CopilotPopup({
3670
3866
  clickOutsideToClose,
3671
3867
  ...chatProps
3672
3868
  }) {
3673
- const PopupViewOverride = useMemo(() => {
3869
+ const PopupViewOverride = useMemo11(() => {
3674
3870
  const Component = (viewProps) => {
3675
3871
  const {
3676
3872
  header: viewHeader,
@@ -3679,7 +3875,7 @@ function CopilotPopup({
3679
3875
  clickOutsideToClose: viewClickOutsideToClose,
3680
3876
  ...restProps
3681
3877
  } = viewProps;
3682
- return /* @__PURE__ */ jsx(
3878
+ return /* @__PURE__ */ jsx25(
3683
3879
  CopilotPopupView,
3684
3880
  {
3685
3881
  ...restProps,
@@ -3692,7 +3888,7 @@ function CopilotPopup({
3692
3888
  };
3693
3889
  return Object.assign(Component, CopilotChatView_default);
3694
3890
  }, [clickOutsideToClose, header, height, width]);
3695
- return /* @__PURE__ */ jsx(
3891
+ return /* @__PURE__ */ jsx25(
3696
3892
  CopilotChat,
3697
3893
  {
3698
3894
  ...chatProps,
@@ -3702,8 +3898,11 @@ function CopilotPopup({
3702
3898
  );
3703
3899
  }
3704
3900
  CopilotPopup.displayName = "CopilotPopup";
3901
+
3902
+ // src/types/defineToolCallRenderer.ts
3903
+ import { z as z2 } from "zod";
3705
3904
  function defineToolCallRenderer(def) {
3706
- const argsSchema = def.name === "*" && !def.args ? z.any() : def.args;
3905
+ const argsSchema = def.name === "*" && !def.args ? z2.any() : def.args;
3707
3906
  return {
3708
3907
  name: def.name,
3709
3908
  args: argsSchema,
@@ -3711,23 +3910,27 @@ function defineToolCallRenderer(def) {
3711
3910
  ...def.agentId ? { agentId: def.agentId } : {}
3712
3911
  };
3713
3912
  }
3913
+
3914
+ // src/components/WildcardToolCallRender.tsx
3915
+ import { useState as useState13 } from "react";
3916
+ import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
3714
3917
  var WildcardToolCallRender = defineToolCallRenderer({
3715
3918
  name: "*",
3716
3919
  render: ({ args, result, name, status }) => {
3717
- const [isExpanded, setIsExpanded] = useState(false);
3920
+ const [isExpanded, setIsExpanded] = useState13(false);
3718
3921
  const statusString = String(status);
3719
3922
  const isActive = statusString === "inProgress" || statusString === "executing";
3720
3923
  const isComplete = statusString === "complete";
3721
3924
  const statusStyles = isActive ? "bg-amber-100 text-amber-800 dark:bg-amber-500/15 dark:text-amber-400" : isComplete ? "bg-emerald-100 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-400" : "bg-zinc-100 text-zinc-800 dark:bg-zinc-700/40 dark:text-zinc-300";
3722
- return /* @__PURE__ */ jsx("div", { className: "mt-2 pb-2", children: /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-zinc-200/60 dark:border-zinc-800/60 bg-white/70 dark:bg-zinc-900/50 shadow-sm backdrop-blur p-4", children: [
3723
- /* @__PURE__ */ jsxs(
3925
+ return /* @__PURE__ */ jsx26("div", { className: "mt-2 pb-2", children: /* @__PURE__ */ jsxs15("div", { className: "rounded-xl border border-zinc-200/60 dark:border-zinc-800/60 bg-white/70 dark:bg-zinc-900/50 shadow-sm backdrop-blur p-4", children: [
3926
+ /* @__PURE__ */ jsxs15(
3724
3927
  "div",
3725
3928
  {
3726
3929
  className: "flex items-center justify-between gap-3 cursor-pointer",
3727
3930
  onClick: () => setIsExpanded(!isExpanded),
3728
3931
  children: [
3729
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [
3730
- /* @__PURE__ */ jsx(
3932
+ /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2 min-w-0", children: [
3933
+ /* @__PURE__ */ jsx26(
3731
3934
  "svg",
3732
3935
  {
3733
3936
  className: `h-4 w-4 text-zinc-500 dark:text-zinc-400 transition-transform ${isExpanded ? "rotate-90" : ""}`,
@@ -3735,7 +3938,7 @@ var WildcardToolCallRender = defineToolCallRenderer({
3735
3938
  viewBox: "0 0 24 24",
3736
3939
  strokeWidth: 2,
3737
3940
  stroke: "currentColor",
3738
- children: /* @__PURE__ */ jsx(
3941
+ children: /* @__PURE__ */ jsx26(
3739
3942
  "path",
3740
3943
  {
3741
3944
  strokeLinecap: "round",
@@ -3745,10 +3948,10 @@ var WildcardToolCallRender = defineToolCallRenderer({
3745
3948
  )
3746
3949
  }
3747
3950
  ),
3748
- /* @__PURE__ */ jsx("span", { className: "inline-block h-2 w-2 rounded-full bg-blue-500" }),
3749
- /* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium text-zinc-900 dark:text-zinc-100", children: name })
3951
+ /* @__PURE__ */ jsx26("span", { className: "inline-block h-2 w-2 rounded-full bg-blue-500" }),
3952
+ /* @__PURE__ */ jsx26("span", { className: "truncate text-sm font-medium text-zinc-900 dark:text-zinc-100", children: name })
3750
3953
  ] }),
3751
- /* @__PURE__ */ jsx(
3954
+ /* @__PURE__ */ jsx26(
3752
3955
  "span",
3753
3956
  {
3754
3957
  className: `inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ${statusStyles}`,
@@ -3758,20 +3961,55 @@ var WildcardToolCallRender = defineToolCallRenderer({
3758
3961
  ]
3759
3962
  }
3760
3963
  ),
3761
- isExpanded && /* @__PURE__ */ jsxs("div", { className: "mt-3 grid gap-4", children: [
3762
- /* @__PURE__ */ jsxs("div", { children: [
3763
- /* @__PURE__ */ jsx("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Arguments" }),
3764
- /* @__PURE__ */ jsx("pre", { className: "mt-2 max-h-64 overflow-auto rounded-md bg-zinc-50 dark:bg-zinc-800/60 p-3 text-xs leading-relaxed text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words", children: JSON.stringify(args ?? {}, null, 2) })
3964
+ isExpanded && /* @__PURE__ */ jsxs15("div", { className: "mt-3 grid gap-4", children: [
3965
+ /* @__PURE__ */ jsxs15("div", { children: [
3966
+ /* @__PURE__ */ jsx26("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Arguments" }),
3967
+ /* @__PURE__ */ jsx26("pre", { className: "mt-2 max-h-64 overflow-auto rounded-md bg-zinc-50 dark:bg-zinc-800/60 p-3 text-xs leading-relaxed text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words", children: JSON.stringify(args ?? {}, null, 2) })
3765
3968
  ] }),
3766
- result !== void 0 && /* @__PURE__ */ jsxs("div", { children: [
3767
- /* @__PURE__ */ jsx("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Result" }),
3768
- /* @__PURE__ */ jsx("pre", { className: "mt-2 max-h-64 overflow-auto rounded-md bg-zinc-50 dark:bg-zinc-800/60 p-3 text-xs leading-relaxed text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words", children: typeof result === "string" ? result : JSON.stringify(result, null, 2) })
3969
+ result !== void 0 && /* @__PURE__ */ jsxs15("div", { children: [
3970
+ /* @__PURE__ */ jsx26("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Result" }),
3971
+ /* @__PURE__ */ jsx26("pre", { className: "mt-2 max-h-64 overflow-auto rounded-md bg-zinc-50 dark:bg-zinc-800/60 p-3 text-xs leading-relaxed text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words", children: typeof result === "string" ? result : JSON.stringify(result, null, 2) })
3769
3972
  ] })
3770
3973
  ] })
3771
3974
  ] }) });
3772
3975
  }
3773
3976
  });
3774
-
3775
- export { AudioRecorderError, CopilotChat, CopilotChatAssistantMessage_default as CopilotChatAssistantMessage, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, CopilotChatInput_default as CopilotChatInput, CopilotChatMessageView_default as CopilotChatMessageView, CopilotChatSuggestionPill_default as CopilotChatSuggestionPill, CopilotChatSuggestionView_default as CopilotChatSuggestionView, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, CopilotChatToolCallsView_default as CopilotChatToolCallsView, CopilotChatUserMessage_default as CopilotChatUserMessage, CopilotChatView_default as CopilotChatView, CopilotKitCoreReact, CopilotKitInspector, CopilotKitProvider, CopilotModalHeader, CopilotPopup, CopilotPopupView, CopilotSidebar, CopilotSidebarView, WildcardToolCallRender, defineToolCallRenderer, useAgent, useAgentContext, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useHumanInTheLoop, useRenderActivityMessage, useRenderCustomMessages, useRenderToolCall, useSuggestions };
3776
- //# sourceMappingURL=index.mjs.map
3977
+ export {
3978
+ AudioRecorderError,
3979
+ CopilotChat,
3980
+ CopilotChatAssistantMessage_default as CopilotChatAssistantMessage,
3981
+ CopilotChatAudioRecorder,
3982
+ CopilotChatConfigurationProvider,
3983
+ CopilotChatInput_default as CopilotChatInput,
3984
+ CopilotChatMessageView_default as CopilotChatMessageView,
3985
+ CopilotChatSuggestionPill_default as CopilotChatSuggestionPill,
3986
+ CopilotChatSuggestionView_default as CopilotChatSuggestionView,
3987
+ CopilotChatToggleButton,
3988
+ DefaultCloseIcon as CopilotChatToggleButtonCloseIcon,
3989
+ DefaultOpenIcon as CopilotChatToggleButtonOpenIcon,
3990
+ CopilotChatToolCallsView_default as CopilotChatToolCallsView,
3991
+ CopilotChatUserMessage_default as CopilotChatUserMessage,
3992
+ CopilotChatView_default as CopilotChatView,
3993
+ CopilotKitCoreReact,
3994
+ CopilotKitInspector,
3995
+ CopilotKitProvider,
3996
+ CopilotModalHeader,
3997
+ CopilotPopup,
3998
+ CopilotPopupView,
3999
+ CopilotSidebar,
4000
+ CopilotSidebarView,
4001
+ WildcardToolCallRender,
4002
+ defineToolCallRenderer,
4003
+ useAgent,
4004
+ useAgentContext,
4005
+ useConfigureSuggestions,
4006
+ useCopilotChatConfiguration,
4007
+ useCopilotKit,
4008
+ useFrontendTool,
4009
+ useHumanInTheLoop,
4010
+ useRenderActivityMessage,
4011
+ useRenderCustomMessages,
4012
+ useRenderToolCall,
4013
+ useSuggestions
4014
+ };
3777
4015
  //# sourceMappingURL=index.mjs.map