@copilotkitnext/react 0.0.11 → 0.0.13-alpha.0

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.js CHANGED
@@ -37,19 +37,29 @@ __export(index_exports, {
37
37
  CopilotChatConfigurationProvider: () => CopilotChatConfigurationProvider,
38
38
  CopilotChatInput: () => CopilotChatInput_default,
39
39
  CopilotChatMessageView: () => CopilotChatMessageView_default,
40
+ CopilotChatSuggestionPill: () => CopilotChatSuggestionPill_default,
41
+ CopilotChatSuggestionView: () => CopilotChatSuggestionView_default,
42
+ CopilotChatToggleButton: () => CopilotChatToggleButton,
43
+ CopilotChatToggleButtonCloseIcon: () => DefaultCloseIcon,
44
+ CopilotChatToggleButtonOpenIcon: () => DefaultOpenIcon,
40
45
  CopilotChatToolCallsView: () => CopilotChatToolCallsView_default,
41
46
  CopilotChatUserMessage: () => CopilotChatUserMessage_default,
42
47
  CopilotChatView: () => CopilotChatView_default,
43
48
  CopilotKitProvider: () => CopilotKitProvider,
49
+ CopilotModalHeader: () => CopilotModalHeader,
50
+ CopilotSidebar: () => CopilotSidebar,
51
+ CopilotSidebarView: () => CopilotSidebarView,
44
52
  WildcardToolCallRender: () => WildcardToolCallRender,
45
53
  defineToolCallRender: () => defineToolCallRender,
46
54
  useAgent: () => useAgent,
47
55
  useAgentContext: () => useAgentContext,
56
+ useConfigureSuggestions: () => useConfigureSuggestions,
48
57
  useCopilotChatConfiguration: () => useCopilotChatConfiguration,
49
58
  useCopilotKit: () => useCopilotKit,
50
59
  useFrontendTool: () => useFrontendTool,
51
60
  useHumanInTheLoop: () => useHumanInTheLoop,
52
- useRenderToolCall: () => useRenderToolCall
61
+ useRenderToolCall: () => useRenderToolCall,
62
+ useSuggestions: () => useSuggestions
53
63
  });
54
64
  module.exports = __toCommonJS(index_exports);
55
65
 
@@ -78,33 +88,60 @@ var CopilotChatDefaultLabels = {
78
88
  assistantMessageToolbarRegenerateLabel: "Regenerate",
79
89
  userMessageToolbarCopyMessageLabel: "Copy",
80
90
  userMessageToolbarEditMessageLabel: "Edit",
81
- chatDisclaimerText: "AI can make mistakes. Please verify important information."
91
+ chatDisclaimerText: "AI can make mistakes. Please verify important information.",
92
+ chatToggleOpenLabel: "Open chat",
93
+ chatToggleCloseLabel: "Close chat",
94
+ modalHeaderTitle: "CopilotKit Chat"
82
95
  };
83
96
  var CopilotChatConfiguration = (0, import_react.createContext)(null);
84
- var CopilotChatConfigurationProvider = ({
85
- children,
86
- labels = {},
87
- agentId,
88
- threadId
89
- }) => {
90
- const mergedLabels = {
91
- ...CopilotChatDefaultLabels,
92
- ...labels
93
- };
94
- const configurationValue = {
95
- labels: mergedLabels,
96
- agentId: agentId ?? import_shared.DEFAULT_AGENT_ID,
97
- threadId
98
- };
97
+ var CopilotChatConfigurationProvider = ({ children, labels, agentId, threadId, isModalDefaultOpen }) => {
98
+ const parentConfig = (0, import_react.useContext)(CopilotChatConfiguration);
99
+ const mergedLabels = (0, import_react.useMemo)(
100
+ () => ({
101
+ ...CopilotChatDefaultLabels,
102
+ ...parentConfig?.labels ?? {},
103
+ ...labels ?? {}
104
+ }),
105
+ [labels, parentConfig?.labels]
106
+ );
107
+ const resolvedAgentId = agentId ?? parentConfig?.agentId ?? import_shared.DEFAULT_AGENT_ID;
108
+ const resolvedThreadId = (0, import_react.useMemo)(() => {
109
+ if (threadId) {
110
+ return threadId;
111
+ }
112
+ if (parentConfig?.threadId) {
113
+ return parentConfig.threadId;
114
+ }
115
+ return (0, import_shared.randomUUID)();
116
+ }, [threadId, parentConfig?.threadId]);
117
+ const resolvedDefaultOpen = isModalDefaultOpen ?? parentConfig?.isModalDefaultOpen ?? true;
118
+ const [internalModalOpen, setInternalModalOpen] = (0, import_react.useState)(
119
+ parentConfig?.isModalOpen ?? resolvedDefaultOpen
120
+ );
121
+ const resolvedIsModalOpen = parentConfig?.isModalOpen ?? internalModalOpen;
122
+ const resolvedSetModalOpen = parentConfig?.setModalOpen ?? setInternalModalOpen;
123
+ const configurationValue = (0, import_react.useMemo)(
124
+ () => ({
125
+ labels: mergedLabels,
126
+ agentId: resolvedAgentId,
127
+ threadId: resolvedThreadId,
128
+ isModalOpen: resolvedIsModalOpen,
129
+ setModalOpen: resolvedSetModalOpen,
130
+ isModalDefaultOpen: resolvedDefaultOpen
131
+ }),
132
+ [
133
+ mergedLabels,
134
+ resolvedAgentId,
135
+ resolvedThreadId,
136
+ resolvedIsModalOpen,
137
+ resolvedSetModalOpen,
138
+ resolvedDefaultOpen
139
+ ]
140
+ );
99
141
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopilotChatConfiguration.Provider, { value: configurationValue, children });
100
142
  };
101
143
  var useCopilotChatConfiguration = () => {
102
144
  const configuration = (0, import_react.useContext)(CopilotChatConfiguration);
103
- if (!configuration) {
104
- throw new Error(
105
- "useCopilotChatConfiguration must be used within CopilotChatConfigurationProvider"
106
- );
107
- }
108
145
  return configuration;
109
146
  };
110
147
 
@@ -554,6 +591,18 @@ function CopilotChatInput({
554
591
  const resolvedValue = isControlled ? value ?? "" : internalValue;
555
592
  const inputRef = (0, import_react4.useRef)(null);
556
593
  const audioRecorderRef = (0, import_react4.useRef)(null);
594
+ const config = useCopilotChatConfiguration();
595
+ const previousModalStateRef = (0, import_react4.useRef)(void 0);
596
+ (0, import_react4.useEffect)(() => {
597
+ if (!autoFocus) {
598
+ previousModalStateRef.current = config?.isModalOpen;
599
+ return;
600
+ }
601
+ if (config?.isModalOpen && !previousModalStateRef.current) {
602
+ inputRef.current?.focus();
603
+ }
604
+ previousModalStateRef.current = config?.isModalOpen;
605
+ }, [config?.isModalOpen, autoFocus]);
557
606
  (0, import_react4.useEffect)(() => {
558
607
  const recorder = audioRecorderRef.current;
559
608
  if (!recorder) {
@@ -604,59 +653,32 @@ function CopilotChatInput({
604
653
  onKeyDown: handleKeyDown,
605
654
  autoFocus
606
655
  });
607
- const BoundAudioRecorder = renderSlot(
608
- audioRecorder,
609
- CopilotChatAudioRecorder,
610
- {
611
- ref: audioRecorderRef
612
- }
613
- );
656
+ const BoundAudioRecorder = renderSlot(audioRecorder, CopilotChatAudioRecorder, {
657
+ ref: audioRecorderRef
658
+ });
614
659
  const BoundSendButton = renderSlot(sendButton, CopilotChatInput.SendButton, {
615
660
  onClick: send,
616
661
  disabled: !resolvedValue.trim() || !onSubmitMessage
617
662
  });
618
- const BoundStartTranscribeButton = renderSlot(
619
- startTranscribeButton,
620
- CopilotChatInput.StartTranscribeButton,
621
- {
622
- onClick: onStartTranscribe
623
- }
624
- );
625
- const BoundCancelTranscribeButton = renderSlot(
626
- cancelTranscribeButton,
627
- CopilotChatInput.CancelTranscribeButton,
628
- {
629
- onClick: onCancelTranscribe
630
- }
631
- );
632
- const BoundFinishTranscribeButton = renderSlot(
633
- finishTranscribeButton,
634
- CopilotChatInput.FinishTranscribeButton,
635
- {
636
- onClick: onFinishTranscribe
637
- }
638
- );
639
- const BoundAddFileButton = renderSlot(
640
- addFileButton,
641
- CopilotChatInput.AddFileButton,
642
- {
643
- onClick: onAddFile,
644
- disabled: mode === "transcribe"
645
- }
646
- );
647
- const BoundToolsButton = renderSlot(
648
- toolsButton,
649
- CopilotChatInput.ToolsButton,
650
- {
651
- disabled: mode === "transcribe",
652
- toolsMenu
653
- }
654
- );
663
+ const BoundStartTranscribeButton = renderSlot(startTranscribeButton, CopilotChatInput.StartTranscribeButton, {
664
+ onClick: onStartTranscribe
665
+ });
666
+ const BoundCancelTranscribeButton = renderSlot(cancelTranscribeButton, CopilotChatInput.CancelTranscribeButton, {
667
+ onClick: onCancelTranscribe
668
+ });
669
+ const BoundFinishTranscribeButton = renderSlot(finishTranscribeButton, CopilotChatInput.FinishTranscribeButton, {
670
+ onClick: onFinishTranscribe
671
+ });
672
+ const BoundAddFileButton = renderSlot(addFileButton, CopilotChatInput.AddFileButton, {
673
+ onClick: onAddFile,
674
+ disabled: mode === "transcribe"
675
+ });
676
+ const BoundToolsButton = renderSlot(toolsButton, CopilotChatInput.ToolsButton, {
677
+ disabled: mode === "transcribe",
678
+ toolsMenu
679
+ });
655
680
  const BoundToolbar = renderSlot(
656
- typeof toolbar === "string" || toolbar === void 0 ? (0, import_tailwind_merge3.twMerge)(
657
- toolbar,
658
- "w-full h-[60px] bg-transparent flex items-center justify-between"
659
- ) : toolbar,
681
+ typeof toolbar === "string" || toolbar === void 0 ? (0, import_tailwind_merge3.twMerge)(toolbar, "w-full h-[60px] bg-transparent flex items-center justify-between") : toolbar,
660
682
  CopilotChatInput.Toolbar,
661
683
  {
662
684
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
@@ -697,6 +719,12 @@ function CopilotChatInput({
697
719
  additionalToolbarItems
698
720
  }) });
699
721
  }
722
+ const handleContainerClick = (e) => {
723
+ const target = e.target;
724
+ if (target.tagName !== "BUTTON" && !target.closest("button") && inputRef.current && mode === "input") {
725
+ inputRef.current.focus();
726
+ }
727
+ };
700
728
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
701
729
  "div",
702
730
  {
@@ -713,6 +741,7 @@ function CopilotChatInput({
713
741
  "shadow-[0_4px_4px_0_#0000000a,0_0_1px_0_#0000009e] rounded-[28px]",
714
742
  className
715
743
  ),
744
+ onClick: handleContainerClick,
716
745
  ...props,
717
746
  children: [
718
747
  mode === "transcribe" ? BoundAudioRecorder : BoundTextArea,
@@ -734,7 +763,8 @@ function CopilotChatInput({
734
763
  }
735
764
  ) });
736
765
  CopilotChatInput2.ToolbarButton = ({ icon, labelKey, defaultClassName, className, ...props }) => {
737
- const { labels } = useCopilotChatConfiguration();
766
+ const config = useCopilotChatConfiguration();
767
+ const labels = config?.labels ?? CopilotChatDefaultLabels;
738
768
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Tooltip, { children: [
739
769
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
740
770
  Button,
@@ -787,7 +817,8 @@ function CopilotChatInput({
787
817
  }
788
818
  );
789
819
  CopilotChatInput2.ToolsButton = ({ className, toolsMenu, ...props }) => {
790
- const { labels } = useCopilotChatConfiguration();
820
+ const config = useCopilotChatConfiguration();
821
+ const labels = config?.labels ?? CopilotChatDefaultLabels;
791
822
  const renderMenuItems = (items) => {
792
823
  return items.map((item, index) => {
793
824
  if (item === "-") {
@@ -823,99 +854,83 @@ function CopilotChatInput({
823
854
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuContent, { side: "top", align: "end", children: renderMenuItems(toolsMenu) })
824
855
  ] });
825
856
  };
826
- CopilotChatInput2.Toolbar = ({
827
- className,
828
- ...props
829
- }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
830
- "div",
831
- {
832
- className: (0, import_tailwind_merge3.twMerge)(
833
- "w-full h-[60px] bg-transparent flex items-center",
834
- className
835
- ),
836
- ...props
837
- }
838
- );
839
- CopilotChatInput2.TextArea = (0, import_react4.forwardRef)(
840
- function TextArea2({ maxRows = 5, style, className, ...props }, ref) {
841
- const internalTextareaRef = (0, import_react4.useRef)(null);
842
- const [maxHeight, setMaxHeight] = (0, import_react4.useState)(0);
843
- const { labels } = useCopilotChatConfiguration();
844
- (0, import_react4.useImperativeHandle)(
845
- ref,
846
- () => internalTextareaRef.current
847
- );
848
- const adjustHeight = () => {
857
+ CopilotChatInput2.Toolbar = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: (0, import_tailwind_merge3.twMerge)("w-full h-[60px] bg-transparent flex items-center", className), ...props });
858
+ CopilotChatInput2.TextArea = (0, import_react4.forwardRef)(function TextArea2({ maxRows = 5, style, className, ...props }, ref) {
859
+ const internalTextareaRef = (0, import_react4.useRef)(null);
860
+ const [maxHeight, setMaxHeight] = (0, import_react4.useState)(0);
861
+ const config = useCopilotChatConfiguration();
862
+ const labels = config?.labels ?? CopilotChatDefaultLabels;
863
+ (0, import_react4.useImperativeHandle)(ref, () => internalTextareaRef.current);
864
+ const adjustHeight = () => {
865
+ const textarea = internalTextareaRef.current;
866
+ if (textarea && maxHeight > 0) {
867
+ textarea.style.height = "auto";
868
+ textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`;
869
+ }
870
+ };
871
+ (0, import_react4.useEffect)(() => {
872
+ const calculateMaxHeight = () => {
849
873
  const textarea = internalTextareaRef.current;
850
- if (textarea && maxHeight > 0) {
874
+ if (textarea) {
875
+ const currentValue = textarea.value;
876
+ textarea.value = "";
851
877
  textarea.style.height = "auto";
852
- textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`;
853
- }
854
- };
855
- (0, import_react4.useEffect)(() => {
856
- const calculateMaxHeight = () => {
857
- const textarea = internalTextareaRef.current;
858
- if (textarea) {
859
- const currentValue = textarea.value;
860
- textarea.value = "";
878
+ const computedStyle = window.getComputedStyle(textarea);
879
+ const paddingTop = parseFloat(computedStyle.paddingTop);
880
+ const paddingBottom = parseFloat(computedStyle.paddingBottom);
881
+ const contentHeight = textarea.scrollHeight - paddingTop - paddingBottom;
882
+ setMaxHeight(contentHeight * maxRows + paddingTop + paddingBottom);
883
+ textarea.value = currentValue;
884
+ if (currentValue) {
861
885
  textarea.style.height = "auto";
862
- const computedStyle = window.getComputedStyle(textarea);
863
- const paddingTop = parseFloat(computedStyle.paddingTop);
864
- const paddingBottom = parseFloat(computedStyle.paddingBottom);
865
- const contentHeight = textarea.scrollHeight - paddingTop - paddingBottom;
866
- setMaxHeight(contentHeight * maxRows + paddingTop + paddingBottom);
867
- textarea.value = currentValue;
868
- if (currentValue) {
869
- textarea.style.height = "auto";
870
- textarea.style.height = `${Math.min(textarea.scrollHeight, contentHeight * maxRows + paddingTop + paddingBottom)}px`;
871
- }
872
- if (props.autoFocus) {
873
- textarea.focus();
874
- }
886
+ textarea.style.height = `${Math.min(textarea.scrollHeight, contentHeight * maxRows + paddingTop + paddingBottom)}px`;
887
+ }
888
+ if (props.autoFocus) {
889
+ textarea.focus();
875
890
  }
876
- };
877
- calculateMaxHeight();
878
- }, [maxRows, props.autoFocus]);
879
- (0, import_react4.useEffect)(() => {
880
- adjustHeight();
881
- }, [props.value, maxHeight]);
882
- const handleInput = (e) => {
883
- adjustHeight();
884
- if (props.onChange) {
885
- props.onChange(e);
886
891
  }
887
892
  };
888
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
889
- "textarea",
890
- {
891
- ref: internalTextareaRef,
892
- ...props,
893
- onChange: handleInput,
894
- style: {
895
- overflow: "auto",
896
- resize: "none",
897
- maxHeight: `${maxHeight}px`,
898
- ...style
899
- },
900
- placeholder: labels.chatInputPlaceholder,
901
- className: (0, import_tailwind_merge3.twMerge)(
902
- // Layout and sizing
903
- "w-full p-5 pb-0",
904
- // Behavior
905
- "outline-none resize-none",
906
- // Background
907
- "bg-transparent",
908
- // Typography
909
- "antialiased font-regular leading-relaxed text-[16px]",
910
- // Placeholder styles
911
- "placeholder:text-[#00000077] dark:placeholder:text-[#fffc]",
912
- className
913
- ),
914
- rows: 1
915
- }
916
- );
917
- }
918
- );
893
+ calculateMaxHeight();
894
+ }, [maxRows, props.autoFocus]);
895
+ (0, import_react4.useEffect)(() => {
896
+ adjustHeight();
897
+ }, [props.value, maxHeight]);
898
+ const handleInput = (e) => {
899
+ adjustHeight();
900
+ if (props.onChange) {
901
+ props.onChange(e);
902
+ }
903
+ };
904
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
905
+ "textarea",
906
+ {
907
+ ref: internalTextareaRef,
908
+ ...props,
909
+ onChange: handleInput,
910
+ style: {
911
+ overflow: "auto",
912
+ resize: "none",
913
+ maxHeight: `${maxHeight}px`,
914
+ ...style
915
+ },
916
+ placeholder: labels.chatInputPlaceholder,
917
+ className: (0, import_tailwind_merge3.twMerge)(
918
+ // Layout and sizing
919
+ "w-full p-5 pb-0",
920
+ // Behavior
921
+ "outline-none resize-none",
922
+ // Background
923
+ "bg-transparent",
924
+ // Typography
925
+ "antialiased font-regular leading-relaxed text-[16px]",
926
+ // Placeholder styles
927
+ "placeholder:text-[#00000077] dark:placeholder:text-[#fffc]",
928
+ className
929
+ ),
930
+ rows: 1
931
+ }
932
+ );
933
+ });
919
934
  CopilotChatInput2.AudioRecorder = CopilotChatAudioRecorder;
920
935
  })(CopilotChatInput || (CopilotChatInput = {}));
921
936
  CopilotChatInput.TextArea.displayName = "CopilotChatInput.TextArea";
@@ -935,7 +950,7 @@ var import_remark_gfm = __toESM(require("remark-gfm"));
935
950
  var import_remark_math = __toESM(require("remark-math"));
936
951
  var import_rehype_pretty_code = __toESM(require("rehype-pretty-code"));
937
952
  var import_rehype_katex = __toESM(require("rehype-katex"));
938
- var import_react13 = require("react");
953
+ var import_react15 = require("react");
939
954
  var import_lucide_react3 = require("lucide-react");
940
955
  var import_tailwind_merge4 = require("tailwind-merge");
941
956
  var import_katex_min = require("katex/dist/katex.min.css");
@@ -1013,9 +1028,7 @@ var CopilotKitProvider = ({
1013
1028
  ...tool.agentId && { agentId: tool.agentId },
1014
1029
  handler: async () => {
1015
1030
  return new Promise((resolve) => {
1016
- console.warn(
1017
- `Human-in-the-loop tool '${tool.name}' called but no interactive handler is set up.`
1018
- );
1031
+ console.warn(`Human-in-the-loop tool '${tool.name}' called but no interactive handler is set up.`);
1019
1032
  resolve(void 0);
1020
1033
  });
1021
1034
  }
@@ -1057,11 +1070,10 @@ var CopilotKitProvider = ({
1057
1070
  }, [renderToolCallsList, frontendToolsList, processedHumanInTheLoopTools]);
1058
1071
  const copilotkit = (0, import_react5.useMemo)(() => {
1059
1072
  const config = {
1060
- // Don't set runtimeUrl during initialization to prevent server-side fetching
1061
- runtimeUrl: void 0,
1073
+ runtimeUrl,
1062
1074
  headers,
1063
1075
  properties,
1064
- agents,
1076
+ agents__unsafe_dev_only: agents,
1065
1077
  tools: allTools
1066
1078
  };
1067
1079
  const copilotkit2 = new import_core.CopilotKitCore(config);
@@ -1097,7 +1109,7 @@ var CopilotKitProvider = ({
1097
1109
  copilotkit.setRuntimeUrl(runtimeUrl);
1098
1110
  copilotkit.setHeaders(headers);
1099
1111
  copilotkit.setProperties(properties);
1100
- copilotkit.setAgents(agents);
1112
+ copilotkit.setAgents__unsafe_dev_only(agents);
1101
1113
  }, [runtimeUrl, headers, properties, agents]);
1102
1114
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1103
1115
  CopilotKitContext.Provider,
@@ -1133,10 +1145,12 @@ var useCopilotKit = () => {
1133
1145
 
1134
1146
  // src/hooks/use-render-tool-call.tsx
1135
1147
  var import_shared2 = require("@copilotkitnext/shared");
1148
+ var import_shared3 = require("@copilotkitnext/shared");
1136
1149
  var import_jsx_runtime8 = require("react/jsx-runtime");
1137
1150
  function useRenderToolCall() {
1138
1151
  const { currentRenderToolCalls, copilotkit } = useCopilotKit();
1139
- const { agentId } = useCopilotChatConfiguration();
1152
+ const config = useCopilotChatConfiguration();
1153
+ const agentId = config?.agentId ?? import_shared2.DEFAULT_AGENT_ID;
1140
1154
  const [executingToolCallIds, setExecutingToolCallIds] = (0, import_react6.useState)(() => /* @__PURE__ */ new Set());
1141
1155
  (0, import_react6.useEffect)(() => {
1142
1156
  const unsubscribe = copilotkit.subscribe({
@@ -1172,7 +1186,7 @@ function useRenderToolCall() {
1172
1186
  return null;
1173
1187
  }
1174
1188
  const RenderComponent = renderConfig.render;
1175
- const args = (0, import_shared2.partialJSONParse)(toolCall.function.arguments);
1189
+ const args = (0, import_shared3.partialJSONParse)(toolCall.function.arguments);
1176
1190
  const toolName = toolCall.function.name;
1177
1191
  if (toolMessage) {
1178
1192
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
@@ -1325,14 +1339,14 @@ function useHumanInTheLoop(tool) {
1325
1339
 
1326
1340
  // src/hooks/use-agent.tsx
1327
1341
  var import_react10 = require("react");
1328
- var import_shared3 = require("@copilotkitnext/shared");
1342
+ var import_shared4 = require("@copilotkitnext/shared");
1329
1343
  var ALL_UPDATES = [
1330
1344
  "OnMessagesChanged" /* OnMessagesChanged */,
1331
1345
  "OnStateChanged" /* OnStateChanged */,
1332
1346
  "OnRunStatusChanged" /* OnRunStatusChanged */
1333
1347
  ];
1334
1348
  function useAgent({ agentId, updates } = {}) {
1335
- agentId ??= import_shared3.DEFAULT_AGENT_ID;
1349
+ agentId ??= import_shared4.DEFAULT_AGENT_ID;
1336
1350
  const { copilotkit } = useCopilotKit();
1337
1351
  const [, forceUpdate] = (0, import_react10.useReducer)((x) => x + 1, 0);
1338
1352
  const updateFlags = (0, import_react10.useMemo)(
@@ -1398,8 +1412,192 @@ function useAgentContext(context) {
1398
1412
  }, [description, value, copilotkit]);
1399
1413
  }
1400
1414
 
1415
+ // src/hooks/use-suggestions.tsx
1416
+ var import_react12 = require("react");
1417
+ var import_shared5 = require("@copilotkitnext/shared");
1418
+ function useSuggestions({ agentId } = {}) {
1419
+ const { copilotkit } = useCopilotKit();
1420
+ const config = useCopilotChatConfiguration();
1421
+ const resolvedAgentId = (0, import_react12.useMemo)(() => agentId ?? config?.agentId ?? import_shared5.DEFAULT_AGENT_ID, [agentId, config?.agentId]);
1422
+ const [suggestions, setSuggestions] = (0, import_react12.useState)(() => {
1423
+ const result = copilotkit.getSuggestions(resolvedAgentId);
1424
+ return result.suggestions;
1425
+ });
1426
+ const [isLoading, setIsLoading] = (0, import_react12.useState)(() => {
1427
+ const result = copilotkit.getSuggestions(resolvedAgentId);
1428
+ return result.isLoading;
1429
+ });
1430
+ (0, import_react12.useEffect)(() => {
1431
+ const result = copilotkit.getSuggestions(resolvedAgentId);
1432
+ setSuggestions(result.suggestions);
1433
+ setIsLoading(result.isLoading);
1434
+ }, [copilotkit, resolvedAgentId]);
1435
+ (0, import_react12.useEffect)(() => {
1436
+ const unsubscribe = copilotkit.subscribe({
1437
+ onSuggestionsChanged: ({ agentId: changedAgentId, suggestions: suggestions2 }) => {
1438
+ if (changedAgentId !== resolvedAgentId) {
1439
+ return;
1440
+ }
1441
+ setSuggestions(suggestions2);
1442
+ },
1443
+ onSuggestionsStartedLoading: ({ agentId: changedAgentId }) => {
1444
+ if (changedAgentId !== resolvedAgentId) {
1445
+ return;
1446
+ }
1447
+ setIsLoading(true);
1448
+ },
1449
+ onSuggestionsFinishedLoading: ({ agentId: changedAgentId }) => {
1450
+ if (changedAgentId !== resolvedAgentId) {
1451
+ return;
1452
+ }
1453
+ setIsLoading(false);
1454
+ },
1455
+ onSuggestionsConfigChanged: () => {
1456
+ const result = copilotkit.getSuggestions(resolvedAgentId);
1457
+ setSuggestions(result.suggestions);
1458
+ setIsLoading(result.isLoading);
1459
+ }
1460
+ });
1461
+ return () => {
1462
+ unsubscribe();
1463
+ };
1464
+ }, [copilotkit, resolvedAgentId]);
1465
+ const reloadSuggestions = (0, import_react12.useCallback)(() => {
1466
+ copilotkit.reloadSuggestions(resolvedAgentId);
1467
+ }, [copilotkit, resolvedAgentId]);
1468
+ const clearSuggestions = (0, import_react12.useCallback)(() => {
1469
+ copilotkit.clearSuggestions(resolvedAgentId);
1470
+ }, [copilotkit, resolvedAgentId]);
1471
+ return {
1472
+ suggestions,
1473
+ reloadSuggestions,
1474
+ clearSuggestions,
1475
+ isLoading
1476
+ };
1477
+ }
1478
+
1479
+ // src/hooks/use-configure-suggestions.tsx
1480
+ var import_react13 = require("react");
1481
+ var import_shared6 = require("@copilotkitnext/shared");
1482
+ var EMPTY_DEPS = [];
1483
+ function useConfigureSuggestions(config, options) {
1484
+ const { copilotkit } = useCopilotKit();
1485
+ const chatConfig = useCopilotChatConfiguration();
1486
+ const extraDeps = options?.deps ?? EMPTY_DEPS;
1487
+ const resolvedConsumerAgentId = (0, import_react13.useMemo)(() => chatConfig?.agentId ?? import_shared6.DEFAULT_AGENT_ID, [chatConfig?.agentId]);
1488
+ const rawConsumerAgentId = (0, import_react13.useMemo)(() => config ? config.consumerAgentId : void 0, [config]);
1489
+ const normalizationCacheRef = (0, import_react13.useRef)({
1490
+ serialized: null,
1491
+ config: null
1492
+ });
1493
+ const { normalizedConfig, serializedConfig } = (0, import_react13.useMemo)(() => {
1494
+ if (!config) {
1495
+ normalizationCacheRef.current = { serialized: null, config: null };
1496
+ return { normalizedConfig: null, serializedConfig: null };
1497
+ }
1498
+ if (config.available === "disabled") {
1499
+ normalizationCacheRef.current = { serialized: null, config: null };
1500
+ return { normalizedConfig: null, serializedConfig: null };
1501
+ }
1502
+ let built;
1503
+ if (isDynamicConfig(config)) {
1504
+ built = {
1505
+ ...config
1506
+ };
1507
+ } else {
1508
+ const normalizedSuggestions = normalizeStaticSuggestions(config.suggestions);
1509
+ const baseConfig = {
1510
+ ...config,
1511
+ suggestions: normalizedSuggestions
1512
+ };
1513
+ built = baseConfig;
1514
+ }
1515
+ const serialized = JSON.stringify(built);
1516
+ const cache = normalizationCacheRef.current;
1517
+ if (cache.serialized === serialized && cache.config) {
1518
+ return { normalizedConfig: cache.config, serializedConfig: serialized };
1519
+ }
1520
+ normalizationCacheRef.current = { serialized, config: built };
1521
+ return { normalizedConfig: built, serializedConfig: serialized };
1522
+ }, [config, resolvedConsumerAgentId, ...extraDeps]);
1523
+ const latestConfigRef = (0, import_react13.useRef)(null);
1524
+ latestConfigRef.current = normalizedConfig;
1525
+ const previousSerializedConfigRef = (0, import_react13.useRef)(null);
1526
+ const targetAgentId = (0, import_react13.useMemo)(() => {
1527
+ if (!normalizedConfig) {
1528
+ return resolvedConsumerAgentId;
1529
+ }
1530
+ const consumer = normalizedConfig.consumerAgentId;
1531
+ if (!consumer || consumer === "*") {
1532
+ return resolvedConsumerAgentId;
1533
+ }
1534
+ return consumer;
1535
+ }, [normalizedConfig, resolvedConsumerAgentId]);
1536
+ const isGlobalConfig = rawConsumerAgentId === void 0 || rawConsumerAgentId === "*";
1537
+ const requestReload = (0, import_react13.useCallback)(() => {
1538
+ if (!normalizedConfig) {
1539
+ return;
1540
+ }
1541
+ if (isGlobalConfig) {
1542
+ const agents = Object.values(copilotkit.agents ?? {});
1543
+ for (const entry of agents) {
1544
+ const agentId = entry.agentId;
1545
+ if (!agentId) {
1546
+ continue;
1547
+ }
1548
+ if (!entry.isRunning) {
1549
+ copilotkit.reloadSuggestions(agentId);
1550
+ }
1551
+ }
1552
+ return;
1553
+ }
1554
+ if (!targetAgentId) {
1555
+ return;
1556
+ }
1557
+ copilotkit.reloadSuggestions(targetAgentId);
1558
+ }, [copilotkit, isGlobalConfig, normalizedConfig, targetAgentId]);
1559
+ (0, import_react13.useEffect)(() => {
1560
+ if (!serializedConfig || !latestConfigRef.current) {
1561
+ return;
1562
+ }
1563
+ const id = copilotkit.addSuggestionsConfig(latestConfigRef.current);
1564
+ requestReload();
1565
+ return () => {
1566
+ copilotkit.removeSuggestionsConfig(id);
1567
+ };
1568
+ }, [copilotkit, serializedConfig, requestReload]);
1569
+ (0, import_react13.useEffect)(() => {
1570
+ if (!normalizedConfig) {
1571
+ previousSerializedConfigRef.current = null;
1572
+ return;
1573
+ }
1574
+ if (serializedConfig && previousSerializedConfigRef.current === serializedConfig) {
1575
+ return;
1576
+ }
1577
+ if (serializedConfig) {
1578
+ previousSerializedConfigRef.current = serializedConfig;
1579
+ }
1580
+ requestReload();
1581
+ }, [normalizedConfig, requestReload, serializedConfig]);
1582
+ (0, import_react13.useEffect)(() => {
1583
+ if (!normalizedConfig || extraDeps.length === 0) {
1584
+ return;
1585
+ }
1586
+ requestReload();
1587
+ }, [extraDeps.length, normalizedConfig, requestReload, ...extraDeps]);
1588
+ }
1589
+ function isDynamicConfig(config) {
1590
+ return "instructions" in config;
1591
+ }
1592
+ function normalizeStaticSuggestions(suggestions) {
1593
+ return suggestions.map((suggestion) => ({
1594
+ ...suggestion,
1595
+ isLoading: suggestion.isLoading ?? false
1596
+ }));
1597
+ }
1598
+
1401
1599
  // src/components/chat/CopilotChatToolCallsView.tsx
1402
- var import_react12 = __toESM(require("react"));
1600
+ var import_react14 = __toESM(require("react"));
1403
1601
  var import_jsx_runtime9 = require("react/jsx-runtime");
1404
1602
  function CopilotChatToolCallsView({
1405
1603
  message,
@@ -1413,7 +1611,7 @@ function CopilotChatToolCallsView({
1413
1611
  const toolMessage = messages.find(
1414
1612
  (m) => m.role === "tool" && m.toolCallId === toolCall.id
1415
1613
  );
1416
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react12.default.Fragment, { children: renderToolCall({
1614
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react14.default.Fragment, { children: renderToolCall({
1417
1615
  toolCall,
1418
1616
  toolMessage
1419
1617
  }) }, toolCall.id);
@@ -1572,8 +1770,9 @@ function CopilotChatAssistantMessage({
1572
1770
  );
1573
1771
  };
1574
1772
  const CodeBlock = ({ children, className, onClick, ...props }) => {
1575
- const { labels } = useCopilotChatConfiguration();
1576
- const [copied, setCopied] = (0, import_react13.useState)(false);
1773
+ const config = useCopilotChatConfiguration();
1774
+ const labels = config?.labels ?? CopilotChatDefaultLabels;
1775
+ const [copied, setCopied] = (0, import_react15.useState)(false);
1577
1776
  const getCodeContent = (node) => {
1578
1777
  if (typeof node === "string") return node;
1579
1778
  if (Array.isArray(node)) return node.map(getCodeContent).join("");
@@ -1685,8 +1884,9 @@ function CopilotChatAssistantMessage({
1685
1884
  ] });
1686
1885
  };
1687
1886
  CopilotChatAssistantMessage2.CopyButton = ({ className, title, onClick, ...props }) => {
1688
- const { labels } = useCopilotChatConfiguration();
1689
- const [copied, setCopied] = (0, import_react13.useState)(false);
1887
+ const config = useCopilotChatConfiguration();
1888
+ const labels = config?.labels ?? CopilotChatDefaultLabels;
1889
+ const [copied, setCopied] = (0, import_react15.useState)(false);
1690
1890
  const handleClick = (event) => {
1691
1891
  setCopied(true);
1692
1892
  setTimeout(() => setCopied(false), 2e3);
@@ -1706,7 +1906,8 @@ function CopilotChatAssistantMessage({
1706
1906
  );
1707
1907
  };
1708
1908
  CopilotChatAssistantMessage2.ThumbsUpButton = ({ title, ...props }) => {
1709
- const { labels } = useCopilotChatConfiguration();
1909
+ const config = useCopilotChatConfiguration();
1910
+ const labels = config?.labels ?? CopilotChatDefaultLabels;
1710
1911
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1711
1912
  CopilotChatAssistantMessage2.ToolbarButton,
1712
1913
  {
@@ -1717,7 +1918,8 @@ function CopilotChatAssistantMessage({
1717
1918
  );
1718
1919
  };
1719
1920
  CopilotChatAssistantMessage2.ThumbsDownButton = ({ title, ...props }) => {
1720
- const { labels } = useCopilotChatConfiguration();
1921
+ const config = useCopilotChatConfiguration();
1922
+ const labels = config?.labels ?? CopilotChatDefaultLabels;
1721
1923
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1722
1924
  CopilotChatAssistantMessage2.ToolbarButton,
1723
1925
  {
@@ -1728,7 +1930,8 @@ function CopilotChatAssistantMessage({
1728
1930
  );
1729
1931
  };
1730
1932
  CopilotChatAssistantMessage2.ReadAloudButton = ({ title, ...props }) => {
1731
- const { labels } = useCopilotChatConfiguration();
1933
+ const config = useCopilotChatConfiguration();
1934
+ const labels = config?.labels ?? CopilotChatDefaultLabels;
1732
1935
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1733
1936
  CopilotChatAssistantMessage2.ToolbarButton,
1734
1937
  {
@@ -1739,7 +1942,8 @@ function CopilotChatAssistantMessage({
1739
1942
  );
1740
1943
  };
1741
1944
  CopilotChatAssistantMessage2.RegenerateButton = ({ title, ...props }) => {
1742
- const { labels } = useCopilotChatConfiguration();
1945
+ const config = useCopilotChatConfiguration();
1946
+ const labels = config?.labels ?? CopilotChatDefaultLabels;
1743
1947
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1744
1948
  CopilotChatAssistantMessage2.ToolbarButton,
1745
1949
  {
@@ -1760,7 +1964,7 @@ CopilotChatAssistantMessage.RegenerateButton.displayName = "CopilotChatAssistant
1760
1964
  var CopilotChatAssistantMessage_default = CopilotChatAssistantMessage;
1761
1965
 
1762
1966
  // src/components/chat/CopilotChatUserMessage.tsx
1763
- var import_react14 = require("react");
1967
+ var import_react16 = require("react");
1764
1968
  var import_lucide_react4 = require("lucide-react");
1765
1969
  var import_tailwind_merge5 = require("tailwind-merge");
1766
1970
  var import_jsx_runtime11 = require("react/jsx-runtime");
@@ -1903,8 +2107,9 @@ function CopilotChatUserMessage({
1903
2107
  ] });
1904
2108
  };
1905
2109
  CopilotChatUserMessage2.CopyButton = ({ className, title, onClick, ...props }) => {
1906
- const { labels } = useCopilotChatConfiguration();
1907
- const [copied, setCopied] = (0, import_react14.useState)(false);
2110
+ const config = useCopilotChatConfiguration();
2111
+ const labels = config?.labels ?? CopilotChatDefaultLabels;
2112
+ const [copied, setCopied] = (0, import_react16.useState)(false);
1908
2113
  const handleClick = (event) => {
1909
2114
  setCopied(true);
1910
2115
  setTimeout(() => setCopied(false), 2e3);
@@ -1924,7 +2129,8 @@ function CopilotChatUserMessage({
1924
2129
  );
1925
2130
  };
1926
2131
  CopilotChatUserMessage2.EditButton = ({ className, title, ...props }) => {
1927
- const { labels } = useCopilotChatConfiguration();
2132
+ const config = useCopilotChatConfiguration();
2133
+ const labels = config?.labels ?? CopilotChatDefaultLabels;
1928
2134
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1929
2135
  CopilotChatUserMessage2.ToolbarButton,
1930
2136
  {
@@ -1996,9 +2202,118 @@ CopilotChatUserMessage.EditButton.displayName = "CopilotChatUserMessage.EditButt
1996
2202
  CopilotChatUserMessage.BranchNavigation.displayName = "CopilotChatUserMessage.BranchNavigation";
1997
2203
  var CopilotChatUserMessage_default = CopilotChatUserMessage;
1998
2204
 
2205
+ // src/components/chat/CopilotChatSuggestionPill.tsx
2206
+ var import_react17 = __toESM(require("react"));
2207
+ var import_lucide_react5 = require("lucide-react");
2208
+ var import_jsx_runtime12 = require("react/jsx-runtime");
2209
+ var baseClasses = "group inline-flex h-8 items-center gap-1.5 rounded-full border border-border/60 bg-background px-3 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";
2210
+ var labelClasses = "whitespace-nowrap font-medium leading-none";
2211
+ var CopilotChatSuggestionPill = import_react17.default.forwardRef(function CopilotChatSuggestionPill2({ className, children, icon, isLoading, type, ...props }, ref) {
2212
+ const showIcon = !isLoading && icon;
2213
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2214
+ "button",
2215
+ {
2216
+ ref,
2217
+ "data-slot": "suggestion-pill",
2218
+ className: cn(baseClasses, className),
2219
+ type: type ?? "button",
2220
+ "aria-busy": isLoading || void 0,
2221
+ disabled: isLoading || props.disabled,
2222
+ ...props,
2223
+ children: [
2224
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "flex h-4 w-4 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.Loader2, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" }) }) : showIcon && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "flex h-4 w-4 items-center justify-center text-muted-foreground", children: icon }),
2225
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: labelClasses, children })
2226
+ ]
2227
+ }
2228
+ );
2229
+ });
2230
+ CopilotChatSuggestionPill.displayName = "CopilotChatSuggestionPill";
2231
+ var CopilotChatSuggestionPill_default = CopilotChatSuggestionPill;
2232
+
2233
+ // src/components/chat/CopilotChatSuggestionView.tsx
2234
+ var import_react18 = __toESM(require("react"));
2235
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2236
+ var DefaultContainer = import_react18.default.forwardRef(function DefaultContainer2({ className, ...props }, ref) {
2237
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2238
+ "div",
2239
+ {
2240
+ ref,
2241
+ className: cn(
2242
+ "flex flex-wrap items-center gap-2 px-4 sm:px-0 pointer-events-none",
2243
+ className
2244
+ ),
2245
+ ...props
2246
+ }
2247
+ );
2248
+ });
2249
+ var CopilotChatSuggestionView = import_react18.default.forwardRef(function CopilotChatSuggestionView2({
2250
+ suggestions,
2251
+ onSelectSuggestion,
2252
+ loadingIndexes,
2253
+ container,
2254
+ suggestion: suggestionSlot,
2255
+ className,
2256
+ children,
2257
+ ...restProps
2258
+ }, ref) {
2259
+ const loadingSet = import_react18.default.useMemo(() => {
2260
+ if (!loadingIndexes || loadingIndexes.length === 0) {
2261
+ return /* @__PURE__ */ new Set();
2262
+ }
2263
+ return new Set(loadingIndexes);
2264
+ }, [loadingIndexes]);
2265
+ const ContainerElement = renderSlot(container, DefaultContainer, {
2266
+ ref,
2267
+ className,
2268
+ ...restProps
2269
+ });
2270
+ const suggestionElements = suggestions.map((suggestion, index) => {
2271
+ const isLoading = loadingSet.has(index) || suggestion.isLoading === true;
2272
+ const pill = renderSlot(suggestionSlot, CopilotChatSuggestionPill_default, {
2273
+ children: suggestion.title,
2274
+ isLoading,
2275
+ type: "button",
2276
+ onClick: () => onSelectSuggestion?.(suggestion, index)
2277
+ });
2278
+ return import_react18.default.cloneElement(pill, {
2279
+ key: `${suggestion.title}-${index}`
2280
+ });
2281
+ });
2282
+ const boundContainer = import_react18.default.cloneElement(
2283
+ ContainerElement,
2284
+ void 0,
2285
+ suggestionElements
2286
+ );
2287
+ if (typeof children === "function") {
2288
+ const sampleSuggestion = renderSlot(suggestionSlot, CopilotChatSuggestionPill_default, {
2289
+ children: suggestions[0]?.title ?? "",
2290
+ isLoading: suggestions.length > 0 ? loadingSet.has(0) || suggestions[0]?.isLoading === true : false,
2291
+ type: "button"
2292
+ });
2293
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: children({
2294
+ container: boundContainer,
2295
+ suggestion: sampleSuggestion,
2296
+ suggestions,
2297
+ onSelectSuggestion,
2298
+ loadingIndexes,
2299
+ className,
2300
+ ...restProps
2301
+ }) });
2302
+ }
2303
+ if (children) {
2304
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
2305
+ boundContainer,
2306
+ children
2307
+ ] });
2308
+ }
2309
+ return boundContainer;
2310
+ });
2311
+ CopilotChatSuggestionView.displayName = "CopilotChatSuggestionView";
2312
+ var CopilotChatSuggestionView_default = CopilotChatSuggestionView;
2313
+
1999
2314
  // src/components/chat/CopilotChatMessageView.tsx
2000
2315
  var import_tailwind_merge6 = require("tailwind-merge");
2001
- var import_jsx_runtime12 = require("react/jsx-runtime");
2316
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2002
2317
  function CopilotChatMessageView({
2003
2318
  messages = [],
2004
2319
  assistantMessage,
@@ -2028,7 +2343,7 @@ function CopilotChatMessageView({
2028
2343
  if (children) {
2029
2344
  return children({ messageElements, messages, isRunning });
2030
2345
  }
2031
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: (0, import_tailwind_merge6.twMerge)("flex flex-col", className), ...props, children: [
2346
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: (0, import_tailwind_merge6.twMerge)("flex flex-col", className), ...props, children: [
2032
2347
  messageElements,
2033
2348
  isRunning && renderSlot(cursor, CopilotChatMessageView.Cursor, {})
2034
2349
  ] });
@@ -2037,7 +2352,7 @@ CopilotChatMessageView.Cursor = function Cursor({
2037
2352
  className,
2038
2353
  ...props
2039
2354
  }) {
2040
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2355
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2041
2356
  "div",
2042
2357
  {
2043
2358
  className: (0, import_tailwind_merge6.twMerge)(
@@ -2051,11 +2366,11 @@ CopilotChatMessageView.Cursor = function Cursor({
2051
2366
  var CopilotChatMessageView_default = CopilotChatMessageView;
2052
2367
 
2053
2368
  // src/components/chat/CopilotChatView.tsx
2054
- var import_react15 = __toESM(require("react"));
2369
+ var import_react19 = __toESM(require("react"));
2055
2370
  var import_tailwind_merge7 = require("tailwind-merge");
2056
2371
  var import_use_stick_to_bottom = require("use-stick-to-bottom");
2057
- var import_lucide_react5 = require("lucide-react");
2058
- var import_jsx_runtime13 = require("react/jsx-runtime");
2372
+ var import_lucide_react6 = require("lucide-react");
2373
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2059
2374
  function CopilotChatView({
2060
2375
  messageView,
2061
2376
  input,
@@ -2064,19 +2379,23 @@ function CopilotChatView({
2064
2379
  feather,
2065
2380
  inputContainer,
2066
2381
  disclaimer,
2382
+ suggestionView,
2067
2383
  messages = [],
2068
2384
  autoScroll = true,
2069
2385
  inputProps,
2070
2386
  isRunning = false,
2387
+ suggestions,
2388
+ suggestionLoadingIndexes,
2389
+ onSelectSuggestion,
2071
2390
  children,
2072
2391
  className,
2073
2392
  ...props
2074
2393
  }) {
2075
- const inputContainerRef = (0, import_react15.useRef)(null);
2076
- const [inputContainerHeight, setInputContainerHeight] = (0, import_react15.useState)(0);
2077
- const [isResizing, setIsResizing] = (0, import_react15.useState)(false);
2078
- const resizeTimeoutRef = (0, import_react15.useRef)(null);
2079
- (0, import_react15.useEffect)(() => {
2394
+ const inputContainerRef = (0, import_react19.useRef)(null);
2395
+ const [inputContainerHeight, setInputContainerHeight] = (0, import_react19.useState)(0);
2396
+ const [isResizing, setIsResizing] = (0, import_react19.useState)(false);
2397
+ const resizeTimeoutRef = (0, import_react19.useRef)(null);
2398
+ (0, import_react19.useEffect)(() => {
2080
2399
  const element = inputContainerRef.current;
2081
2400
  if (!element) return;
2082
2401
  const resizeObserver = new ResizeObserver((entries) => {
@@ -2110,40 +2429,38 @@ function CopilotChatView({
2110
2429
  messages,
2111
2430
  isRunning
2112
2431
  });
2113
- const BoundInput = renderSlot(
2114
- input,
2115
- CopilotChatInput_default,
2116
- inputProps ?? {}
2117
- );
2432
+ const BoundInput = renderSlot(input, CopilotChatInput_default, inputProps ?? {});
2433
+ const hasSuggestions = Array.isArray(suggestions) && suggestions.length > 0;
2434
+ const BoundSuggestionView = hasSuggestions ? renderSlot(
2435
+ suggestionView,
2436
+ CopilotChatSuggestionView_default,
2437
+ {
2438
+ suggestions,
2439
+ loadingIndexes: suggestionLoadingIndexes,
2440
+ onSelectSuggestion,
2441
+ className: "mb-3 lg:ml-4 lg:mr-4 ml-0 mr-0"
2442
+ }
2443
+ ) : null;
2118
2444
  const BoundFeather = renderSlot(feather, CopilotChatView.Feather, {});
2119
2445
  const BoundScrollView = renderSlot(scrollView, CopilotChatView.ScrollView, {
2120
2446
  autoScroll,
2121
2447
  scrollToBottomButton,
2122
2448
  inputContainerHeight,
2123
2449
  isResizing,
2124
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { paddingBottom: `${inputContainerHeight + 32}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "max-w-3xl mx-auto", children: BoundMessageView }) })
2450
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { paddingBottom: `${inputContainerHeight + (hasSuggestions ? 4 : 32)}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "max-w-3xl mx-auto", children: [
2451
+ BoundMessageView,
2452
+ hasSuggestions ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "px-4 sm:px-0 mt-4", children: BoundSuggestionView }) : null
2453
+ ] }) })
2454
+ });
2455
+ const BoundScrollToBottomButton = renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, {});
2456
+ const BoundDisclaimer = renderSlot(disclaimer, CopilotChatView.Disclaimer, {});
2457
+ const BoundInputContainer = renderSlot(inputContainer, CopilotChatView.InputContainer, {
2458
+ ref: inputContainerRef,
2459
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
2460
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "max-w-3xl mx-auto py-0 px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 pointer-events-auto", children: BoundInput }),
2461
+ BoundDisclaimer
2462
+ ] })
2125
2463
  });
2126
- const BoundScrollToBottomButton = renderSlot(
2127
- scrollToBottomButton,
2128
- CopilotChatView.ScrollToBottomButton,
2129
- {}
2130
- );
2131
- const BoundDisclaimer = renderSlot(
2132
- disclaimer,
2133
- CopilotChatView.Disclaimer,
2134
- {}
2135
- );
2136
- const BoundInputContainer = renderSlot(
2137
- inputContainer,
2138
- CopilotChatView.InputContainer,
2139
- {
2140
- ref: inputContainerRef,
2141
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
2142
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "max-w-3xl mx-auto py-0 px-4 sm:px-0", children: BoundInput }),
2143
- BoundDisclaimer
2144
- ] })
2145
- }
2146
- );
2147
2464
  if (children) {
2148
2465
  return children({
2149
2466
  messageView: BoundMessageView,
@@ -2152,10 +2469,11 @@ function CopilotChatView({
2152
2469
  scrollToBottomButton: BoundScrollToBottomButton,
2153
2470
  feather: BoundFeather,
2154
2471
  inputContainer: BoundInputContainer,
2155
- disclaimer: BoundDisclaimer
2472
+ disclaimer: BoundDisclaimer,
2473
+ suggestionView: BoundSuggestionView ?? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, {})
2156
2474
  });
2157
2475
  }
2158
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: (0, import_tailwind_merge7.twMerge)("relative h-full", className), ...props, children: [
2476
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: (0, import_tailwind_merge7.twMerge)("relative h-full", className), ...props, children: [
2159
2477
  BoundScrollView,
2160
2478
  BoundFeather,
2161
2479
  BoundInputContainer
@@ -2164,22 +2482,18 @@ function CopilotChatView({
2164
2482
  ((CopilotChatView2) => {
2165
2483
  const ScrollContent = ({ children, scrollToBottomButton, inputContainerHeight, isResizing }) => {
2166
2484
  const { isAtBottom, scrollToBottom } = (0, import_use_stick_to_bottom.useStickToBottomContext)();
2167
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
2168
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_use_stick_to_bottom.StickToBottom.Content, { className: "overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "px-4 sm:px-0", children }) }),
2169
- !isAtBottom && !isResizing && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2485
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
2486
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_use_stick_to_bottom.StickToBottom.Content, { className: "overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8", children }) }),
2487
+ !isAtBottom && !isResizing && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2170
2488
  "div",
2171
2489
  {
2172
- className: "absolute inset-x-0 flex justify-center z-10",
2490
+ className: "absolute inset-x-0 flex justify-center z-10 pointer-events-none",
2173
2491
  style: {
2174
2492
  bottom: `${inputContainerHeight + 16}px`
2175
2493
  },
2176
- children: renderSlot(
2177
- scrollToBottomButton,
2178
- CopilotChatView2.ScrollToBottomButton,
2179
- {
2180
- onClick: () => scrollToBottom()
2181
- }
2182
- )
2494
+ children: renderSlot(scrollToBottomButton, CopilotChatView2.ScrollToBottomButton, {
2495
+ onClick: () => scrollToBottom()
2496
+ })
2183
2497
  }
2184
2498
  )
2185
2499
  ] });
@@ -2193,13 +2507,13 @@ function CopilotChatView({
2193
2507
  className,
2194
2508
  ...props
2195
2509
  }) => {
2196
- const [hasMounted, setHasMounted] = (0, import_react15.useState)(false);
2510
+ const [hasMounted, setHasMounted] = (0, import_react19.useState)(false);
2197
2511
  const { scrollRef, contentRef, scrollToBottom } = (0, import_use_stick_to_bottom.useStickToBottom)();
2198
- const [showScrollButton, setShowScrollButton] = (0, import_react15.useState)(false);
2199
- (0, import_react15.useEffect)(() => {
2512
+ const [showScrollButton, setShowScrollButton] = (0, import_react19.useState)(false);
2513
+ (0, import_react19.useEffect)(() => {
2200
2514
  setHasMounted(true);
2201
2515
  }, []);
2202
- (0, import_react15.useEffect)(() => {
2516
+ (0, import_react19.useEffect)(() => {
2203
2517
  if (autoScroll) return;
2204
2518
  const scrollElement = scrollRef.current;
2205
2519
  if (!scrollElement) return;
@@ -2217,45 +2531,44 @@ function CopilotChatView({
2217
2531
  };
2218
2532
  }, [scrollRef, autoScroll]);
2219
2533
  if (!hasMounted) {
2220
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "h-full max-h-full flex flex-col min-h-0 overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "px-4 sm:px-0", children }) });
2534
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "h-full max-h-full flex flex-col min-h-0 overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8", children }) });
2221
2535
  }
2222
2536
  if (!autoScroll) {
2223
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2537
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2224
2538
  "div",
2225
2539
  {
2226
2540
  ref: scrollRef,
2227
- className: cn("h-full max-h-full flex flex-col min-h-0 overflow-y-scroll overflow-x-hidden relative", className),
2541
+ className: cn(
2542
+ "h-full max-h-full flex flex-col min-h-0 overflow-y-scroll overflow-x-hidden relative",
2543
+ className
2544
+ ),
2228
2545
  ...props,
2229
2546
  children: [
2230
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { ref: contentRef, className: "px-4 sm:px-0", children }),
2231
- showScrollButton && !isResizing && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2547
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ref: contentRef, className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8", children }),
2548
+ showScrollButton && !isResizing && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2232
2549
  "div",
2233
2550
  {
2234
- className: "absolute inset-x-0 flex justify-center z-10",
2551
+ className: "absolute inset-x-0 flex justify-center z-10 pointer-events-none",
2235
2552
  style: {
2236
2553
  bottom: `${inputContainerHeight + 16}px`
2237
2554
  },
2238
- children: renderSlot(
2239
- scrollToBottomButton,
2240
- CopilotChatView2.ScrollToBottomButton,
2241
- {
2242
- onClick: () => scrollToBottom()
2243
- }
2244
- )
2555
+ children: renderSlot(scrollToBottomButton, CopilotChatView2.ScrollToBottomButton, {
2556
+ onClick: () => scrollToBottom()
2557
+ })
2245
2558
  }
2246
2559
  )
2247
2560
  ]
2248
2561
  }
2249
2562
  );
2250
2563
  }
2251
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2564
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2252
2565
  import_use_stick_to_bottom.StickToBottom,
2253
2566
  {
2254
2567
  className: cn("h-full max-h-full flex flex-col min-h-0 relative", className),
2255
2568
  resize: "smooth",
2256
2569
  initial: "smooth",
2257
2570
  ...props,
2258
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2571
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2259
2572
  ScrollContent,
2260
2573
  {
2261
2574
  scrollToBottomButton,
@@ -2267,13 +2580,16 @@ function CopilotChatView({
2267
2580
  }
2268
2581
  );
2269
2582
  };
2270
- CopilotChatView2.ScrollToBottomButton = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2583
+ CopilotChatView2.ScrollToBottomButton = ({
2584
+ className,
2585
+ ...props
2586
+ }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2271
2587
  Button,
2272
2588
  {
2273
2589
  variant: "outline",
2274
2590
  size: "sm",
2275
2591
  className: (0, import_tailwind_merge7.twMerge)(
2276
- "rounded-full w-10 h-10 p-0",
2592
+ "rounded-full w-10 h-10 p-0 pointer-events-auto",
2277
2593
  "bg-white dark:bg-gray-900",
2278
2594
  "shadow-lg border border-gray-200 dark:border-gray-700",
2279
2595
  "hover:bg-gray-50 dark:hover:bg-gray-800",
@@ -2281,14 +2597,10 @@ function CopilotChatView({
2281
2597
  className
2282
2598
  ),
2283
2599
  ...props,
2284
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react5.ChevronDown, { className: "w-4 h-4 text-gray-600 dark:text-white" })
2600
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react6.ChevronDown, { className: "w-4 h-4 text-gray-600 dark:text-white" })
2285
2601
  }
2286
2602
  );
2287
- CopilotChatView2.Feather = ({
2288
- className,
2289
- style,
2290
- ...props
2291
- }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2603
+ CopilotChatView2.Feather = ({ className, style, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2292
2604
  "div",
2293
2605
  {
2294
2606
  className: cn(
@@ -2301,28 +2613,15 @@ function CopilotChatView({
2301
2613
  ...props
2302
2614
  }
2303
2615
  );
2304
- CopilotChatView2.InputContainer = import_react15.default.forwardRef(({ children, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2305
- "div",
2306
- {
2307
- ref,
2308
- className: cn("absolute bottom-0 left-0 right-0 z-20", className),
2309
- ...props,
2310
- children
2311
- }
2312
- ));
2616
+ CopilotChatView2.InputContainer = import_react19.default.forwardRef(({ children, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ref, className: cn("absolute bottom-0 left-0 right-0 z-20 pointer-events-none", className), ...props, children }));
2313
2617
  CopilotChatView2.InputContainer.displayName = "CopilotChatView.InputContainer";
2314
- CopilotChatView2.Disclaimer = ({
2315
- className,
2316
- ...props
2317
- }) => {
2318
- const { labels } = useCopilotChatConfiguration();
2319
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2618
+ CopilotChatView2.Disclaimer = ({ className, ...props }) => {
2619
+ const config = useCopilotChatConfiguration();
2620
+ const labels = config?.labels ?? CopilotChatDefaultLabels;
2621
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2320
2622
  "div",
2321
2623
  {
2322
- className: cn(
2323
- "text-center text-xs text-muted-foreground py-3 px-4 max-w-3xl mx-auto",
2324
- className
2325
- ),
2624
+ className: cn("text-center text-xs text-muted-foreground py-3 px-4 max-w-3xl mx-auto", className),
2326
2625
  ...props,
2327
2626
  children: labels.chatDisclaimerText
2328
2627
  }
@@ -2332,23 +2631,31 @@ function CopilotChatView({
2332
2631
  var CopilotChatView_default = CopilotChatView;
2333
2632
 
2334
2633
  // src/components/chat/CopilotChat.tsx
2335
- var import_shared4 = require("@copilotkitnext/shared");
2336
- var import_react16 = require("react");
2634
+ var import_shared7 = require("@copilotkitnext/shared");
2635
+ var import_react20 = require("react");
2337
2636
  var import_ts_deepmerge = require("ts-deepmerge");
2338
2637
  var import_client = require("@ag-ui/client");
2339
- var import_jsx_runtime14 = require("react/jsx-runtime");
2340
- function CopilotChat({
2341
- agentId = import_shared4.DEFAULT_AGENT_ID,
2342
- threadId,
2343
- ...props
2344
- }) {
2345
- const { agent } = useAgent({ agentId });
2638
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2639
+ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen, ...props }) {
2640
+ const existingConfig = useCopilotChatConfiguration();
2641
+ const resolvedAgentId = agentId ?? existingConfig?.agentId ?? import_shared7.DEFAULT_AGENT_ID;
2642
+ const resolvedThreadId = (0, import_react20.useMemo)(
2643
+ () => threadId ?? existingConfig?.threadId ?? (0, import_shared7.randomUUID)(),
2644
+ [threadId, existingConfig?.threadId]
2645
+ );
2646
+ const { agent } = useAgent({ agentId: resolvedAgentId });
2346
2647
  const { copilotkit } = useCopilotKit();
2347
- const resolvedThreadId = (0, import_react16.useMemo)(() => threadId ?? (0, import_shared4.randomUUID)(), [threadId]);
2348
- (0, import_react16.useEffect)(() => {
2648
+ const { suggestions: autoSuggestions } = useSuggestions({ agentId: resolvedAgentId });
2649
+ const {
2650
+ inputProps: providedInputProps,
2651
+ messageView: providedMessageView,
2652
+ suggestionView: providedSuggestionView,
2653
+ ...restProps
2654
+ } = props;
2655
+ (0, import_react20.useEffect)(() => {
2349
2656
  const connect = async (agent2) => {
2350
2657
  try {
2351
- await copilotkit.connectAgent({ agent: agent2, agentId });
2658
+ await copilotkit.connectAgent({ agent: agent2 });
2352
2659
  } catch (error) {
2353
2660
  if (error instanceof import_client.AGUIConnectNotImplementedError) {
2354
2661
  } else {
@@ -2362,59 +2669,392 @@ function CopilotChat({
2362
2669
  }
2363
2670
  return () => {
2364
2671
  };
2365
- }, [resolvedThreadId, agent, copilotkit, agentId]);
2366
- const onSubmitInput = (0, import_react16.useCallback)(
2672
+ }, [resolvedThreadId, agent, copilotkit, resolvedAgentId]);
2673
+ const onSubmitInput = (0, import_react20.useCallback)(
2367
2674
  async (value) => {
2368
2675
  agent?.addMessage({
2369
- id: (0, import_shared4.randomUUID)(),
2676
+ id: (0, import_shared7.randomUUID)(),
2370
2677
  role: "user",
2371
2678
  content: value
2372
2679
  });
2373
2680
  if (agent) {
2374
2681
  try {
2375
- await copilotkit.runAgent({ agent, agentId });
2682
+ await copilotkit.runAgent({ agent });
2376
2683
  } catch (error) {
2377
2684
  console.error("CopilotChat: runAgent failed", error);
2378
2685
  }
2379
2686
  }
2380
2687
  },
2381
- [agent, copilotkit, agentId]
2688
+ [agent, copilotkit]
2689
+ );
2690
+ const handleSelectSuggestion = (0, import_react20.useCallback)(
2691
+ async (suggestion) => {
2692
+ if (!agent) {
2693
+ return;
2694
+ }
2695
+ agent.addMessage({
2696
+ id: (0, import_shared7.randomUUID)(),
2697
+ role: "user",
2698
+ content: suggestion.message
2699
+ });
2700
+ try {
2701
+ await copilotkit.runAgent({ agent });
2702
+ } catch (error) {
2703
+ console.error("CopilotChat: runAgent failed after selecting suggestion", error);
2704
+ }
2705
+ },
2706
+ [agent, copilotkit]
2382
2707
  );
2383
- const {
2384
- inputProps: providedInputProps,
2385
- messageView: providedMessageView,
2386
- ...restProps
2387
- } = props;
2388
2708
  const mergedProps = (0, import_ts_deepmerge.merge)(
2389
2709
  {
2390
- isRunning: agent?.isRunning ?? false
2710
+ isRunning: agent?.isRunning ?? false,
2711
+ suggestions: autoSuggestions,
2712
+ onSelectSuggestion: handleSelectSuggestion,
2713
+ suggestionView: providedSuggestionView
2391
2714
  },
2392
2715
  {
2393
2716
  ...restProps,
2394
2717
  ...typeof providedMessageView === "string" ? { messageView: { className: providedMessageView } } : providedMessageView !== void 0 ? { messageView: providedMessageView } : {}
2395
2718
  }
2396
2719
  );
2397
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2720
+ const finalProps = (0, import_ts_deepmerge.merge)(mergedProps, {
2721
+ messages: agent?.messages ?? [],
2722
+ inputProps: {
2723
+ onSubmitMessage: onSubmitInput,
2724
+ ...providedInputProps
2725
+ }
2726
+ });
2727
+ const RenderedChatView = renderSlot(chatView, CopilotChatView, finalProps);
2728
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2398
2729
  CopilotChatConfigurationProvider,
2399
2730
  {
2400
- agentId,
2731
+ agentId: resolvedAgentId,
2401
2732
  threadId: resolvedThreadId,
2402
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2403
- CopilotChatView,
2733
+ labels,
2734
+ isModalDefaultOpen,
2735
+ children: RenderedChatView
2736
+ }
2737
+ );
2738
+ }
2739
+ ((CopilotChat2) => {
2740
+ CopilotChat2.View = CopilotChatView;
2741
+ })(CopilotChat || (CopilotChat = {}));
2742
+
2743
+ // src/components/chat/CopilotChatToggleButton.tsx
2744
+ var import_react21 = __toESM(require("react"));
2745
+ var import_lucide_react7 = require("lucide-react");
2746
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2747
+ var DefaultOpenIcon = ({
2748
+ className,
2749
+ ...props
2750
+ }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.MessageCircle, { className: cn("h-6 w-6", className), strokeWidth: 1.75, fill: "currentColor", ...props });
2751
+ var DefaultCloseIcon = ({
2752
+ className,
2753
+ ...props
2754
+ }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.X, { className: cn("h-6 w-6", className), strokeWidth: 1.75, ...props });
2755
+ DefaultOpenIcon.displayName = "CopilotChatToggleButton.OpenIcon";
2756
+ DefaultCloseIcon.displayName = "CopilotChatToggleButton.CloseIcon";
2757
+ var ICON_TRANSITION_STYLE = Object.freeze({
2758
+ transition: "opacity 120ms ease-out, transform 260ms cubic-bezier(0.22, 1, 0.36, 1)"
2759
+ });
2760
+ var ICON_WRAPPER_BASE = "pointer-events-none absolute inset-0 flex items-center justify-center will-change-transform";
2761
+ var BUTTON_BASE_CLASSES = cn(
2762
+ "fixed bottom-6 right-6 z-[1100] flex h-14 w-14 items-center justify-center",
2763
+ "rounded-full border border-primary bg-primary text-primary-foreground",
2764
+ "shadow-sm transition-all duration-200 ease-out",
2765
+ "hover:scale-[1.04] hover:shadow-md",
2766
+ "cursor-pointer",
2767
+ "active:scale-[0.96]",
2768
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background",
2769
+ "disabled:pointer-events-none disabled:opacity-60"
2770
+ );
2771
+ var CopilotChatToggleButton = import_react21.default.forwardRef(function CopilotChatToggleButton2({ openIcon, closeIcon, className, ...buttonProps }, ref) {
2772
+ const { onClick, type, disabled, ...restProps } = buttonProps;
2773
+ const configuration = useCopilotChatConfiguration();
2774
+ const labels = configuration?.labels ?? CopilotChatDefaultLabels;
2775
+ const [fallbackOpen, setFallbackOpen] = (0, import_react21.useState)(false);
2776
+ const isOpen = configuration?.isModalOpen ?? fallbackOpen;
2777
+ const setModalOpen = configuration?.setModalOpen ?? setFallbackOpen;
2778
+ const handleClick = (event) => {
2779
+ if (disabled) {
2780
+ return;
2781
+ }
2782
+ if (onClick) {
2783
+ onClick(event);
2784
+ }
2785
+ if (event.defaultPrevented) {
2786
+ return;
2787
+ }
2788
+ const nextOpen = !isOpen;
2789
+ setModalOpen(nextOpen);
2790
+ };
2791
+ const renderedOpenIcon = renderSlot(
2792
+ openIcon,
2793
+ DefaultOpenIcon,
2794
+ {
2795
+ className: "h-6 w-6",
2796
+ "aria-hidden": true,
2797
+ focusable: false
2798
+ }
2799
+ );
2800
+ const renderedCloseIcon = renderSlot(
2801
+ closeIcon,
2802
+ DefaultCloseIcon,
2803
+ {
2804
+ className: "h-6 w-6",
2805
+ "aria-hidden": true,
2806
+ focusable: false
2807
+ }
2808
+ );
2809
+ const openIconElement = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2810
+ "span",
2811
+ {
2812
+ "aria-hidden": "true",
2813
+ "data-slot": "chat-toggle-button-open-icon",
2814
+ className: ICON_WRAPPER_BASE,
2815
+ style: {
2816
+ ...ICON_TRANSITION_STYLE,
2817
+ opacity: isOpen ? 0 : 1,
2818
+ transform: `scale(${isOpen ? 0.75 : 1}) rotate(${isOpen ? 90 : 0}deg)`
2819
+ },
2820
+ children: renderedOpenIcon
2821
+ }
2822
+ );
2823
+ const closeIconElement = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2824
+ "span",
2825
+ {
2826
+ "aria-hidden": "true",
2827
+ "data-slot": "chat-toggle-button-close-icon",
2828
+ className: ICON_WRAPPER_BASE,
2829
+ style: {
2830
+ ...ICON_TRANSITION_STYLE,
2831
+ opacity: isOpen ? 1 : 0,
2832
+ transform: `scale(${isOpen ? 1 : 0.75}) rotate(${isOpen ? 0 : -90}deg)`
2833
+ },
2834
+ children: renderedCloseIcon
2835
+ }
2836
+ );
2837
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2838
+ "button",
2839
+ {
2840
+ ref,
2841
+ type: type ?? "button",
2842
+ "data-slot": "chat-toggle-button",
2843
+ "data-state": isOpen ? "open" : "closed",
2844
+ className: cn(BUTTON_BASE_CLASSES, className),
2845
+ "aria-label": isOpen ? labels.chatToggleCloseLabel : labels.chatToggleOpenLabel,
2846
+ "aria-pressed": isOpen,
2847
+ disabled,
2848
+ onClick: handleClick,
2849
+ ...restProps,
2850
+ children: [
2851
+ openIconElement,
2852
+ closeIconElement
2853
+ ]
2854
+ }
2855
+ );
2856
+ });
2857
+ CopilotChatToggleButton.displayName = "CopilotChatToggleButton";
2858
+ var CopilotChatToggleButton_default = CopilotChatToggleButton;
2859
+
2860
+ // src/components/chat/CopilotSidebarView.tsx
2861
+ var import_react23 = require("react");
2862
+
2863
+ // src/components/chat/CopilotModalHeader.tsx
2864
+ var import_react22 = require("react");
2865
+ var import_lucide_react8 = require("lucide-react");
2866
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2867
+ function CopilotModalHeader({
2868
+ title,
2869
+ titleContent,
2870
+ closeButton,
2871
+ children,
2872
+ className,
2873
+ ...rest
2874
+ }) {
2875
+ const configuration = useCopilotChatConfiguration();
2876
+ const fallbackTitle = configuration?.labels.modalHeaderTitle ?? CopilotChatDefaultLabels.modalHeaderTitle;
2877
+ const resolvedTitle = title ?? fallbackTitle;
2878
+ const handleClose = (0, import_react22.useCallback)(() => {
2879
+ configuration?.setModalOpen(false);
2880
+ }, [configuration]);
2881
+ const BoundTitle = renderSlot(titleContent, CopilotModalHeader.Title, {
2882
+ children: resolvedTitle
2883
+ });
2884
+ const BoundCloseButton = renderSlot(closeButton, CopilotModalHeader.CloseButton, {
2885
+ onClick: handleClose
2886
+ });
2887
+ if (children) {
2888
+ return children({
2889
+ titleContent: BoundTitle,
2890
+ closeButton: BoundCloseButton,
2891
+ title: resolvedTitle,
2892
+ ...rest
2893
+ });
2894
+ }
2895
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2896
+ "header",
2897
+ {
2898
+ "data-slot": "copilot-modal-header",
2899
+ className: cn(
2900
+ "flex items-center justify-between border-b border-border px-4 py-4",
2901
+ "bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",
2902
+ className
2903
+ ),
2904
+ ...rest,
2905
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex w-full items-center gap-2", children: [
2906
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1", "aria-hidden": "true" }),
2907
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-1 justify-center text-center", children: BoundTitle }),
2908
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-1 justify-end", children: BoundCloseButton })
2909
+ ] })
2910
+ }
2911
+ );
2912
+ }
2913
+ CopilotModalHeader.displayName = "CopilotModalHeader";
2914
+ ((CopilotModalHeader2) => {
2915
+ CopilotModalHeader2.Title = ({ children, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2916
+ "div",
2917
+ {
2918
+ className: cn(
2919
+ "w-full text-base font-medium leading-none tracking-tight text-foreground",
2920
+ className
2921
+ ),
2922
+ ...props,
2923
+ children
2924
+ }
2925
+ );
2926
+ CopilotModalHeader2.CloseButton = ({
2927
+ className,
2928
+ ...props
2929
+ }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2930
+ "button",
2931
+ {
2932
+ type: "button",
2933
+ className: cn(
2934
+ "inline-flex size-8 items-center justify-center rounded-full text-muted-foreground transition cursor-pointer",
2935
+ "hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2936
+ className
2937
+ ),
2938
+ "aria-label": "Close",
2939
+ ...props,
2940
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.X, { className: "h-4 w-4", "aria-hidden": "true" })
2941
+ }
2942
+ );
2943
+ })(CopilotModalHeader || (CopilotModalHeader = {}));
2944
+ CopilotModalHeader.Title.displayName = "CopilotModalHeader.Title";
2945
+ CopilotModalHeader.CloseButton.displayName = "CopilotModalHeader.CloseButton";
2946
+
2947
+ // src/components/chat/CopilotSidebarView.tsx
2948
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2949
+ var DEFAULT_SIDEBAR_WIDTH = 480;
2950
+ var SIDEBAR_TRANSITION_MS = 260;
2951
+ function CopilotSidebarView({ header, width, ...props }) {
2952
+ const configuration = useCopilotChatConfiguration();
2953
+ const isSidebarOpen = configuration?.isModalOpen ?? false;
2954
+ const sidebarRef = (0, import_react23.useRef)(null);
2955
+ const [sidebarWidth, setSidebarWidth] = (0, import_react23.useState)(width ?? DEFAULT_SIDEBAR_WIDTH);
2956
+ const widthToCss = (w) => {
2957
+ return typeof w === "number" ? `${w}px` : w;
2958
+ };
2959
+ const widthToMargin = (w) => {
2960
+ if (typeof w === "number") {
2961
+ return `${w}px`;
2962
+ }
2963
+ return w;
2964
+ };
2965
+ (0, import_react23.useEffect)(() => {
2966
+ if (width !== void 0) {
2967
+ return;
2968
+ }
2969
+ if (typeof window === "undefined") {
2970
+ return;
2971
+ }
2972
+ const element = sidebarRef.current;
2973
+ if (!element) {
2974
+ return;
2975
+ }
2976
+ const updateWidth = () => {
2977
+ const rect = element.getBoundingClientRect();
2978
+ if (rect.width > 0) {
2979
+ setSidebarWidth(rect.width);
2980
+ }
2981
+ };
2982
+ updateWidth();
2983
+ if (typeof ResizeObserver !== "undefined") {
2984
+ const observer = new ResizeObserver(() => updateWidth());
2985
+ observer.observe(element);
2986
+ return () => observer.disconnect();
2987
+ }
2988
+ window.addEventListener("resize", updateWidth);
2989
+ return () => window.removeEventListener("resize", updateWidth);
2990
+ }, [width]);
2991
+ const headerElement = renderSlot(header, CopilotModalHeader, {});
2992
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
2993
+ isSidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2994
+ "style",
2995
+ {
2996
+ dangerouslySetInnerHTML: {
2997
+ __html: `body {
2998
+ margin-inline-end: ${widthToMargin(sidebarWidth)};
2999
+ transition: margin-inline-end ${SIDEBAR_TRANSITION_MS}ms ease;
3000
+ }`
3001
+ }
3002
+ }
3003
+ ),
3004
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CopilotChatToggleButton_default, {}),
3005
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3006
+ "aside",
3007
+ {
3008
+ ref: sidebarRef,
3009
+ "data-copilot-sidebar": true,
3010
+ className: cn(
3011
+ "fixed right-0 top-0 z-[1200] flex h-dvh max-h-screen",
3012
+ "border-l border-border bg-background text-foreground shadow-xl",
3013
+ "transition-transform duration-300 ease-out",
3014
+ isSidebarOpen ? "translate-x-0" : "translate-x-full pointer-events-none"
3015
+ ),
3016
+ style: { width: widthToCss(sidebarWidth) },
3017
+ "aria-hidden": !isSidebarOpen,
3018
+ "aria-label": "Copilot chat sidebar",
3019
+ role: "complementary",
3020
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex h-full w-full flex-col overflow-hidden", children: [
3021
+ headerElement,
3022
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex-1 overflow-hidden", "data-sidebar-chat": true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CopilotChatView_default, { ...props }) })
3023
+ ] })
3024
+ }
3025
+ )
3026
+ ] });
3027
+ }
3028
+ CopilotSidebarView.displayName = "CopilotSidebarView";
3029
+
3030
+ // src/components/chat/CopilotSidebar.tsx
3031
+ var import_react24 = require("react");
3032
+ var import_jsx_runtime20 = require("react/jsx-runtime");
3033
+ function CopilotSidebar({ header, defaultOpen, width, ...chatProps }) {
3034
+ const SidebarViewOverride = (0, import_react24.useMemo)(() => {
3035
+ const Component = (viewProps) => {
3036
+ const { header: viewHeader, width: viewWidth, ...restProps } = viewProps;
3037
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3038
+ CopilotSidebarView,
2404
3039
  {
2405
- ...{
2406
- messages: agent?.messages ?? [],
2407
- inputProps: {
2408
- onSubmitMessage: onSubmitInput,
2409
- ...providedInputProps
2410
- },
2411
- ...mergedProps
2412
- }
3040
+ ...restProps,
3041
+ header: header ?? viewHeader,
3042
+ width: width ?? viewWidth
2413
3043
  }
2414
- )
3044
+ );
3045
+ };
3046
+ return Object.assign(Component, CopilotChatView_default);
3047
+ }, [header, width]);
3048
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3049
+ CopilotChat,
3050
+ {
3051
+ ...chatProps,
3052
+ chatView: SidebarViewOverride,
3053
+ isModalDefaultOpen: defaultOpen
2415
3054
  }
2416
3055
  );
2417
3056
  }
3057
+ CopilotSidebar.displayName = "CopilotSidebar";
2418
3058
 
2419
3059
  // src/types/defineToolCallRender.ts
2420
3060
  var import_zod2 = require("zod");
@@ -2429,25 +3069,25 @@ function defineToolCallRender(def) {
2429
3069
  }
2430
3070
 
2431
3071
  // src/components/WildcardToolCallRender.tsx
2432
- var import_react17 = require("react");
2433
- var import_jsx_runtime15 = require("react/jsx-runtime");
3072
+ var import_react25 = require("react");
3073
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2434
3074
  var WildcardToolCallRender = defineToolCallRender({
2435
3075
  name: "*",
2436
3076
  render: ({ args, result, name, status }) => {
2437
- const [isExpanded, setIsExpanded] = (0, import_react17.useState)(false);
3077
+ const [isExpanded, setIsExpanded] = (0, import_react25.useState)(false);
2438
3078
  const statusString = String(status);
2439
3079
  const isActive = statusString === "inProgress" || statusString === "executing";
2440
3080
  const isComplete = statusString === "complete";
2441
3081
  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";
2442
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "mt-2 pb-2", children: /* @__PURE__ */ (0, import_jsx_runtime15.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: [
2443
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3082
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "mt-2 pb-2", children: /* @__PURE__ */ (0, import_jsx_runtime21.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: [
3083
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2444
3084
  "div",
2445
3085
  {
2446
3086
  className: "flex items-center justify-between gap-3 cursor-pointer",
2447
3087
  onClick: () => setIsExpanded(!isExpanded),
2448
3088
  children: [
2449
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2 min-w-0", children: [
2450
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3089
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2 min-w-0", children: [
3090
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2451
3091
  "svg",
2452
3092
  {
2453
3093
  className: `h-4 w-4 text-zinc-500 dark:text-zinc-400 transition-transform ${isExpanded ? "rotate-90" : ""}`,
@@ -2455,7 +3095,7 @@ var WildcardToolCallRender = defineToolCallRender({
2455
3095
  viewBox: "0 0 24 24",
2456
3096
  strokeWidth: 2,
2457
3097
  stroke: "currentColor",
2458
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3098
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2459
3099
  "path",
2460
3100
  {
2461
3101
  strokeLinecap: "round",
@@ -2465,10 +3105,10 @@ var WildcardToolCallRender = defineToolCallRender({
2465
3105
  )
2466
3106
  }
2467
3107
  ),
2468
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "inline-block h-2 w-2 rounded-full bg-blue-500" }),
2469
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "truncate text-sm font-medium text-zinc-900 dark:text-zinc-100", children: name })
3108
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-block h-2 w-2 rounded-full bg-blue-500" }),
3109
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate text-sm font-medium text-zinc-900 dark:text-zinc-100", children: name })
2470
3110
  ] }),
2471
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3111
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2472
3112
  "span",
2473
3113
  {
2474
3114
  className: `inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ${statusStyles}`,
@@ -2478,14 +3118,14 @@ var WildcardToolCallRender = defineToolCallRender({
2478
3118
  ]
2479
3119
  }
2480
3120
  ),
2481
- isExpanded && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "mt-3 grid gap-4", children: [
2482
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
2483
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Arguments" }),
2484
- /* @__PURE__ */ (0, import_jsx_runtime15.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) })
3121
+ isExpanded && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "mt-3 grid gap-4", children: [
3122
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
3123
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Arguments" }),
3124
+ /* @__PURE__ */ (0, import_jsx_runtime21.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) })
2485
3125
  ] }),
2486
- result !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
2487
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Result" }),
2488
- /* @__PURE__ */ (0, import_jsx_runtime15.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) })
3126
+ result !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
3127
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Result" }),
3128
+ /* @__PURE__ */ (0, import_jsx_runtime21.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) })
2489
3129
  ] })
2490
3130
  ] })
2491
3131
  ] }) });
@@ -2500,18 +3140,28 @@ var WildcardToolCallRender = defineToolCallRender({
2500
3140
  CopilotChatConfigurationProvider,
2501
3141
  CopilotChatInput,
2502
3142
  CopilotChatMessageView,
3143
+ CopilotChatSuggestionPill,
3144
+ CopilotChatSuggestionView,
3145
+ CopilotChatToggleButton,
3146
+ CopilotChatToggleButtonCloseIcon,
3147
+ CopilotChatToggleButtonOpenIcon,
2503
3148
  CopilotChatToolCallsView,
2504
3149
  CopilotChatUserMessage,
2505
3150
  CopilotChatView,
2506
3151
  CopilotKitProvider,
3152
+ CopilotModalHeader,
3153
+ CopilotSidebar,
3154
+ CopilotSidebarView,
2507
3155
  WildcardToolCallRender,
2508
3156
  defineToolCallRender,
2509
3157
  useAgent,
2510
3158
  useAgentContext,
3159
+ useConfigureSuggestions,
2511
3160
  useCopilotChatConfiguration,
2512
3161
  useCopilotKit,
2513
3162
  useFrontendTool,
2514
3163
  useHumanInTheLoop,
2515
- useRenderToolCall
3164
+ useRenderToolCall,
3165
+ useSuggestions
2516
3166
  });
2517
3167
  //# sourceMappingURL=index.js.map