@copilotkit/react-ui 1.8.13-next.2 → 1.8.13

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/{chunk-3R6CEFJE.mjs → chunk-FWKHST6I.mjs} +67 -33
  3. package/dist/chunk-FWKHST6I.mjs.map +1 -0
  4. package/dist/{chunk-ZRW27A32.mjs → chunk-IAHSHPRJ.mjs} +12 -13
  5. package/dist/chunk-IAHSHPRJ.mjs.map +1 -0
  6. package/dist/{chunk-XZNY26GH.mjs → chunk-IMBPSLL4.mjs} +3 -3
  7. package/dist/chunk-IMBPSLL4.mjs.map +1 -0
  8. package/dist/{chunk-756IINQI.mjs → chunk-JU3HNL5N.mjs} +2 -2
  9. package/dist/{chunk-IQ7DDXDA.mjs → chunk-QEZ3YYLO.mjs} +2 -2
  10. package/dist/chunk-QGSPTXOV.mjs +24 -0
  11. package/dist/chunk-QGSPTXOV.mjs.map +1 -0
  12. package/dist/chunk-SC6JRFAJ.mjs +1 -0
  13. package/dist/components/chat/Button.d.ts +1 -0
  14. package/dist/components/chat/Chat.d.ts +6 -2
  15. package/dist/components/chat/Chat.js +39 -24
  16. package/dist/components/chat/Chat.js.map +1 -1
  17. package/dist/components/chat/Chat.mjs +3 -2
  18. package/dist/components/chat/Header.d.ts +1 -0
  19. package/dist/components/chat/Input.d.ts +1 -0
  20. package/dist/components/chat/Messages.d.ts +1 -0
  21. package/dist/components/chat/Modal.d.ts +2 -2
  22. package/dist/components/chat/Modal.js +106 -62
  23. package/dist/components/chat/Modal.js.map +1 -1
  24. package/dist/components/chat/Modal.mjs +4 -3
  25. package/dist/components/chat/Popup.d.ts +1 -1
  26. package/dist/components/chat/Popup.js +108 -64
  27. package/dist/components/chat/Popup.js.map +1 -1
  28. package/dist/components/chat/Popup.mjs +5 -4
  29. package/dist/components/chat/Sidebar.d.ts +1 -1
  30. package/dist/components/chat/Sidebar.js +108 -64
  31. package/dist/components/chat/Sidebar.js.map +1 -1
  32. package/dist/components/chat/Sidebar.mjs +5 -4
  33. package/dist/components/chat/Suggestion.d.ts +8 -4
  34. package/dist/components/chat/Suggestion.js +2 -2
  35. package/dist/components/chat/Suggestion.js.map +1 -1
  36. package/dist/components/chat/Suggestion.mjs +1 -1
  37. package/dist/components/chat/Suggestions.d.ts +9 -0
  38. package/dist/components/chat/Suggestions.js +73 -0
  39. package/dist/components/chat/Suggestions.js.map +1 -0
  40. package/dist/components/chat/Suggestions.mjs +10 -0
  41. package/dist/components/chat/Suggestions.mjs.map +1 -0
  42. package/dist/components/chat/Window.d.ts +1 -0
  43. package/dist/components/chat/index.d.ts +4 -2
  44. package/dist/components/chat/index.js +114 -66
  45. package/dist/components/chat/index.js.map +1 -1
  46. package/dist/components/chat/index.mjs +14 -7
  47. package/dist/components/chat/messages/AssistantMessage.d.ts +1 -0
  48. package/dist/components/chat/messages/RenderActionExecutionMessage.d.ts +1 -0
  49. package/dist/components/chat/messages/RenderAgentStateMessage.d.ts +1 -0
  50. package/dist/components/chat/messages/RenderImageMessage.d.ts +1 -0
  51. package/dist/components/chat/messages/RenderResultMessage.d.ts +1 -0
  52. package/dist/components/chat/messages/RenderTextMessage.d.ts +1 -0
  53. package/dist/components/chat/messages/UserMessage.d.ts +1 -0
  54. package/dist/components/chat/props.d.ts +6 -1
  55. package/dist/components/chat/props.js.map +1 -1
  56. package/dist/components/index.d.ts +4 -2
  57. package/dist/components/index.js +114 -66
  58. package/dist/components/index.js.map +1 -1
  59. package/dist/components/index.mjs +14 -7
  60. package/dist/index.d.ts +4 -2
  61. package/dist/index.js +114 -66
  62. package/dist/index.js.map +1 -1
  63. package/dist/index.mjs +14 -7
  64. package/dist/types/index.d.ts +1 -0
  65. package/dist/types/index.js.map +1 -1
  66. package/package.json +4 -4
  67. package/src/components/chat/Chat.tsx +12 -14
  68. package/src/components/chat/Modal.tsx +2 -0
  69. package/src/components/chat/Suggestion.tsx +10 -3
  70. package/src/components/chat/Suggestions.tsx +20 -0
  71. package/src/components/chat/index.tsx +2 -0
  72. package/src/components/chat/props.ts +6 -0
  73. package/src/types/index.ts +1 -0
  74. package/dist/chunk-3R6CEFJE.mjs.map +0 -1
  75. package/dist/chunk-PXEVB7IK.mjs +0 -1
  76. package/dist/chunk-XZNY26GH.mjs.map +0 -1
  77. package/dist/chunk-ZRW27A32.mjs.map +0 -1
  78. /package/dist/{chunk-756IINQI.mjs.map → chunk-JU3HNL5N.mjs.map} +0 -0
  79. /package/dist/{chunk-IQ7DDXDA.mjs.map → chunk-QEZ3YYLO.mjs.map} +0 -0
  80. /package/dist/{chunk-PXEVB7IK.mjs.map → chunk-SC6JRFAJ.mjs.map} +0 -0
@@ -1,12 +1,12 @@
1
- import "../../chunk-PXEVB7IK.mjs";
1
+ import "../../chunk-SC6JRFAJ.mjs";
2
+ import "../../chunk-WB3YULQ4.mjs";
2
3
  import {
3
4
  CopilotPopup
4
- } from "../../chunk-IQ7DDXDA.mjs";
5
+ } from "../../chunk-QEZ3YYLO.mjs";
5
6
  import {
6
7
  CopilotSidebar
7
- } from "../../chunk-756IINQI.mjs";
8
- import "../../chunk-WB3YULQ4.mjs";
9
- import "../../chunk-3R6CEFJE.mjs";
8
+ } from "../../chunk-JU3HNL5N.mjs";
9
+ import "../../chunk-FWKHST6I.mjs";
10
10
  import "../../chunk-TIDV74OE.mjs";
11
11
  import "../../chunk-UH2UFL5W.mjs";
12
12
  import "../../chunk-V7W6IM2V.mjs";
@@ -19,7 +19,7 @@ import "../../chunk-BH6PCAAL.mjs";
19
19
  import "../../chunk-UFN2VWSR.mjs";
20
20
  import {
21
21
  CopilotChat
22
- } from "../../chunk-ZRW27A32.mjs";
22
+ } from "../../chunk-IAHSHPRJ.mjs";
23
23
  import "../../chunk-MPZAMNCN.mjs";
24
24
  import "../../chunk-ALWZ35SI.mjs";
25
25
  import {
@@ -33,7 +33,12 @@ import {
33
33
  import {
34
34
  UserMessage
35
35
  } from "../../chunk-HWMFMBJC.mjs";
36
- import "../../chunk-XZNY26GH.mjs";
36
+ import {
37
+ Suggestions
38
+ } from "../../chunk-QGSPTXOV.mjs";
39
+ import {
40
+ Suggestion
41
+ } from "../../chunk-IMBPSLL4.mjs";
37
42
  import "../../chunk-PLHTVHUW.mjs";
38
43
  import "../../chunk-EMIYIMQ6.mjs";
39
44
  import "../../chunk-CGEAG65D.mjs";
@@ -58,6 +63,8 @@ export {
58
63
  CopilotSidebar,
59
64
  Markdown,
60
65
  RenderImageMessage,
66
+ Suggestion as RenderSuggestion,
67
+ Suggestions as RenderSuggestionsList,
61
68
  UserMessage,
62
69
  useChatContext
63
70
  };
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { AssistantMessageProps } from '../props.js';
3
3
  import '@copilotkit/runtime-client-gql';
4
+ import '../../../types/suggestions.js';
4
5
  import 'react';
5
6
 
6
7
  declare const AssistantMessage: (props: AssistantMessageProps) => react_jsx_runtime.JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { RenderMessageProps } from '../props.js';
3
3
  import '@copilotkit/runtime-client-gql';
4
+ import '../../../types/suggestions.js';
4
5
  import 'react';
5
6
 
6
7
  declare function RenderActionExecutionMessage({ AssistantMessage, ...props }: RenderMessageProps): react_jsx_runtime.JSX.Element | null | undefined;
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { RenderMessageProps } from '../props.js';
3
3
  import '@copilotkit/runtime-client-gql';
4
+ import '../../../types/suggestions.js';
4
5
  import 'react';
5
6
 
6
7
  declare function RenderAgentStateMessage({ AssistantMessage, ...props }: RenderMessageProps): react_jsx_runtime.JSX.Element | null | undefined;
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { RenderMessageProps } from '../props.js';
3
3
  import '@copilotkit/runtime-client-gql';
4
+ import '../../../types/suggestions.js';
4
5
  import 'react';
5
6
 
6
7
  declare function RenderImageMessage({ UserMessage, AssistantMessage, ...props }: RenderMessageProps): react_jsx_runtime.JSX.Element | null;
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { RenderMessageProps } from '../props.js';
3
3
  import '@copilotkit/runtime-client-gql';
4
+ import '../../../types/suggestions.js';
4
5
  import 'react';
5
6
 
6
7
  declare function RenderResultMessage({ AssistantMessage, ...props }: RenderMessageProps): react_jsx_runtime.JSX.Element | null;
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { RenderMessageProps } from '../props.js';
3
3
  import '@copilotkit/runtime-client-gql';
4
+ import '../../../types/suggestions.js';
4
5
  import 'react';
5
6
 
6
7
  declare function RenderTextMessage({ UserMessage, AssistantMessage, ...props }: RenderMessageProps): react_jsx_runtime.JSX.Element | undefined;
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { UserMessageProps } from '../props.js';
3
3
  import '@copilotkit/runtime-client-gql';
4
+ import '../../../types/suggestions.js';
4
5
  import 'react';
5
6
 
6
7
  declare const UserMessage: (props: UserMessageProps) => react_jsx_runtime.JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { Message } from '@copilotkit/runtime-client-gql';
2
+ import { CopilotChatSuggestion } from '../../types/suggestions.js';
2
3
  import { ReactNode } from 'react';
3
4
 
4
5
  interface ButtonProps {
@@ -150,5 +151,9 @@ interface InputProps {
150
151
  onStop?: () => void;
151
152
  onUpload?: () => void;
152
153
  }
154
+ interface RenderSuggestionsListProps {
155
+ suggestions: CopilotChatSuggestion[];
156
+ onSuggestionClick: (message: string) => void;
157
+ }
153
158
 
154
- export { AssistantMessageProps, ButtonProps, ComponentsMap, HeaderProps, InputProps, MessagesProps, RenderMessageProps, Renderer, SuggestionsProps, UserMessageProps, WindowProps };
159
+ export { AssistantMessageProps, ButtonProps, ComponentsMap, HeaderProps, InputProps, MessagesProps, RenderMessageProps, RenderSuggestionsListProps, Renderer, SuggestionsProps, UserMessageProps, WindowProps };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/chat/props.ts"],"sourcesContent":["import { Message } from \"@copilotkit/runtime-client-gql\";\nimport { ReactNode } from \"react\";\n\nexport interface ButtonProps {}\n\nexport interface WindowProps {\n clickOutsideToClose: boolean;\n hitEscapeToClose: boolean;\n shortcut: string;\n children?: React.ReactNode;\n}\n\nexport interface HeaderProps {}\n\nexport interface SuggestionsProps {\n title: string;\n message: string;\n partial?: boolean;\n className?: string;\n onClick: (message: string) => void;\n}\n\nexport type ComponentsMap<T extends Record<string, object> = Record<string, object>> = {\n [K in keyof T]: React.FC<{ children?: ReactNode } & T[K]>;\n};\n\nexport interface MessagesProps {\n messages: Message[];\n inProgress: boolean;\n children?: React.ReactNode;\n AssistantMessage: React.ComponentType<AssistantMessageProps>;\n UserMessage: React.ComponentType<UserMessageProps>;\n RenderTextMessage: React.ComponentType<RenderMessageProps>;\n RenderActionExecutionMessage: React.ComponentType<RenderMessageProps>;\n RenderAgentStateMessage: React.ComponentType<RenderMessageProps>;\n RenderResultMessage: React.ComponentType<RenderMessageProps>;\n RenderImageMessage: React.ComponentType<RenderMessageProps>;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: (messageId: string) => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: string) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: string) => void;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n}\n\nexport interface Renderer {\n content: string;\n}\n\nexport interface UserMessageProps {\n message?: string;\n rawData: any;\n subComponent?: React.JSX.Element;\n}\n\nexport interface AssistantMessageProps {\n /**\n * The message content from the assistant\n */\n\n message?: string;\n\n /**\n * Indicates if this is the last message\n */\n isCurrentMessage?: boolean;\n\n /**\n * The raw data from the assistant's response\n */\n rawData: any;\n\n /**\n * A component that was decided to render by the LLM.\n * When working with useCopilotActions and useCoAgentStateRender, this will be\n * the render component that was specified.\n */\n subComponent?: React.JSX.Element;\n\n /**\n * Whether a response is loading, this is when the LLM is thinking of a response but hasn't finished yet.\n */\n isLoading: boolean;\n\n /**\n * Whether a response is generating, this is when the LLM is actively generating and streaming content.\n */\n isGenerating: boolean;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: () => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: string) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: string) => void;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n}\n\nexport interface RenderMessageProps {\n message: Message;\n inProgress: boolean;\n index: number;\n isCurrentMessage: boolean;\n actionResult?: string;\n AssistantMessage?: React.ComponentType<AssistantMessageProps>;\n UserMessage?: React.ComponentType<UserMessageProps>;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: (messageId: string) => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: string) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: string) => void;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n}\n\nexport interface InputProps {\n inProgress: boolean;\n onSend: (text: string) => Promise<Message>;\n isVisible?: boolean;\n onStop?: () => void;\n onUpload?: () => void;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/chat/props.ts"],"sourcesContent":["import { Message } from \"@copilotkit/runtime-client-gql\";\nimport { CopilotChatSuggestion } from \"../../types/suggestions\";\nimport { ReactNode } from \"react\";\n\nexport interface ButtonProps {}\n\nexport interface WindowProps {\n clickOutsideToClose: boolean;\n hitEscapeToClose: boolean;\n shortcut: string;\n children?: React.ReactNode;\n}\n\nexport interface HeaderProps {}\n\nexport interface SuggestionsProps {\n title: string;\n message: string;\n partial?: boolean;\n className?: string;\n onClick: (message: string) => void;\n}\n\nexport type ComponentsMap<T extends Record<string, object> = Record<string, object>> = {\n [K in keyof T]: React.FC<{ children?: ReactNode } & T[K]>;\n};\n\nexport interface MessagesProps {\n messages: Message[];\n inProgress: boolean;\n children?: React.ReactNode;\n AssistantMessage: React.ComponentType<AssistantMessageProps>;\n UserMessage: React.ComponentType<UserMessageProps>;\n RenderTextMessage: React.ComponentType<RenderMessageProps>;\n RenderActionExecutionMessage: React.ComponentType<RenderMessageProps>;\n RenderAgentStateMessage: React.ComponentType<RenderMessageProps>;\n RenderResultMessage: React.ComponentType<RenderMessageProps>;\n RenderImageMessage: React.ComponentType<RenderMessageProps>;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: (messageId: string) => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: string) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: string) => void;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n}\n\nexport interface Renderer {\n content: string;\n}\n\nexport interface UserMessageProps {\n message?: string;\n rawData: any;\n subComponent?: React.JSX.Element;\n}\n\nexport interface AssistantMessageProps {\n /**\n * The message content from the assistant\n */\n\n message?: string;\n\n /**\n * Indicates if this is the last message\n */\n isCurrentMessage?: boolean;\n\n /**\n * The raw data from the assistant's response\n */\n rawData: any;\n\n /**\n * A component that was decided to render by the LLM.\n * When working with useCopilotActions and useCoAgentStateRender, this will be\n * the render component that was specified.\n */\n subComponent?: React.JSX.Element;\n\n /**\n * Whether a response is loading, this is when the LLM is thinking of a response but hasn't finished yet.\n */\n isLoading: boolean;\n\n /**\n * Whether a response is generating, this is when the LLM is actively generating and streaming content.\n */\n isGenerating: boolean;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: () => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: string) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: string) => void;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n}\n\nexport interface RenderMessageProps {\n message: Message;\n inProgress: boolean;\n index: number;\n isCurrentMessage: boolean;\n actionResult?: string;\n AssistantMessage?: React.ComponentType<AssistantMessageProps>;\n UserMessage?: React.ComponentType<UserMessageProps>;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: (messageId: string) => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: string) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: string) => void;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n}\n\nexport interface InputProps {\n inProgress: boolean;\n onSend: (text: string) => Promise<Message>;\n isVisible?: boolean;\n onStop?: () => void;\n onUpload?: () => void;\n}\n\nexport interface RenderSuggestionsListProps {\n suggestions: CopilotChatSuggestion[];\n onSuggestionClick: (message: string) => void;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,4 +1,4 @@
1
- export { AssistantMessageProps, ButtonProps, ComponentsMap, HeaderProps, InputProps, MessagesProps, RenderMessageProps, Renderer, SuggestionsProps, UserMessageProps, WindowProps } from './chat/props.js';
1
+ export { AssistantMessageProps, ButtonProps, ComponentsMap, HeaderProps, InputProps, MessagesProps, RenderMessageProps, RenderSuggestionsListProps, Renderer, SuggestionsProps, UserMessageProps, WindowProps } from './chat/props.js';
2
2
  export { CopilotPopup } from './chat/Popup.js';
3
3
  export { CopilotSidebar } from './chat/Sidebar.js';
4
4
  export { CopilotChat } from './chat/Chat.js';
@@ -7,13 +7,15 @@ export { AssistantMessage } from './chat/messages/AssistantMessage.js';
7
7
  export { UserMessage } from './chat/messages/UserMessage.js';
8
8
  export { useChatContext } from './chat/ChatContext.js';
9
9
  export { RenderImageMessage } from './chat/messages/RenderImageMessage.js';
10
+ export { Suggestions as RenderSuggestionsList } from './chat/Suggestions.js';
11
+ export { Suggestion as RenderSuggestion } from './chat/Suggestion.js';
10
12
  export { shouldShowDevConsole } from './dev-console/utils.js';
11
13
  export { CopilotDevConsole } from './dev-console/console.js';
12
14
  import '@copilotkit/runtime-client-gql';
15
+ import '../types/suggestions.js';
13
16
  import 'react';
14
17
  import 'react/jsx-runtime';
15
18
  import './chat/Modal.js';
16
19
  import '@copilotkit/react-core';
17
- import '../types/suggestions.js';
18
20
  import 'react-markdown';
19
21
  import './dev-console/types.js';
@@ -86,6 +86,8 @@ __export(components_exports, {
86
86
  CopilotSidebar: () => CopilotSidebar,
87
87
  Markdown: () => Markdown,
88
88
  RenderImageMessage: () => RenderImageMessage,
89
+ RenderSuggestion: () => Suggestion,
90
+ RenderSuggestionsList: () => Suggestions,
89
91
  UserMessage: () => UserMessage,
90
92
  shouldShowDevConsole: () => shouldShowDevConsole,
91
93
  useChatContext: () => useChatContext
@@ -2495,19 +2497,23 @@ function RenderImageMessage(_a) {
2495
2497
  return null;
2496
2498
  }
2497
2499
 
2500
+ // src/components/chat/Chat.tsx
2501
+ var import_react13 = __toESM(require("react"));
2502
+ var import_react_core10 = require("@copilotkit/react-core");
2503
+
2498
2504
  // src/components/chat/Suggestion.tsx
2499
2505
  var import_react_core9 = require("@copilotkit/react-core");
2500
2506
  var import_shared2 = require("@copilotkit/shared");
2501
2507
  var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
2502
2508
  var import_jsx_runtime23 = require("react/jsx-runtime");
2503
- function Suggestion({ title, message, onClick, partial, className }) {
2509
+ function Suggestion({ title, onClick, partial, className }) {
2504
2510
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2505
2511
  "button",
2506
2512
  {
2507
2513
  disabled: partial,
2508
2514
  onClick: (e) => {
2509
2515
  e.preventDefault();
2510
- onClick(message);
2516
+ onClick();
2511
2517
  },
2512
2518
  className: className || (partial ? "suggestion loading" : "suggestion"),
2513
2519
  "data-test-id": "suggestion",
@@ -2586,8 +2592,6 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
2586
2592
  });
2587
2593
 
2588
2594
  // src/components/chat/Chat.tsx
2589
- var import_react13 = __toESM(require("react"));
2590
- var import_react_core10 = require("@copilotkit/react-core");
2591
2595
  var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
2592
2596
  var import_shared3 = require("@copilotkit/shared");
2593
2597
  var import_react_core11 = require("@copilotkit/react-core");
@@ -2670,8 +2674,24 @@ var ImageUploadQueue = ({
2670
2674
  );
2671
2675
  };
2672
2676
 
2673
- // src/components/chat/Chat.tsx
2677
+ // src/components/chat/Suggestions.tsx
2674
2678
  var import_jsx_runtime25 = require("react/jsx-runtime");
2679
+ function Suggestions({ suggestions, onSuggestionClick }) {
2680
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "suggestions", children: suggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2681
+ Suggestion,
2682
+ {
2683
+ title: suggestion.title,
2684
+ message: suggestion.message,
2685
+ partial: suggestion.partial,
2686
+ className: suggestion.className,
2687
+ onClick: () => onSuggestionClick(suggestion.message)
2688
+ },
2689
+ index
2690
+ )) });
2691
+ }
2692
+
2693
+ // src/components/chat/Chat.tsx
2694
+ var import_jsx_runtime26 = require("react/jsx-runtime");
2675
2695
  function CopilotChat({
2676
2696
  instructions,
2677
2697
  onSubmitMessage,
@@ -2690,6 +2710,7 @@ function CopilotChat({
2690
2710
  RenderAgentStateMessage: RenderAgentStateMessage2 = RenderAgentStateMessage,
2691
2711
  RenderResultMessage: RenderResultMessage2 = RenderResultMessage,
2692
2712
  RenderImageMessage: RenderImageMessage2 = RenderImageMessage,
2713
+ RenderSuggestionsList = Suggestions,
2693
2714
  Input: Input2 = Input,
2694
2715
  className,
2695
2716
  icons,
@@ -2829,8 +2850,8 @@ function CopilotChat({
2829
2850
  const removeSelectedImage = (index) => {
2830
2851
  setSelectedImages((prev) => prev.filter((_, i) => i !== index));
2831
2852
  };
2832
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
2833
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2853
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
2854
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2834
2855
  Messages2,
2835
2856
  {
2836
2857
  AssistantMessage: AssistantMessage2,
@@ -2847,22 +2868,18 @@ function CopilotChat({
2847
2868
  onThumbsUp,
2848
2869
  onThumbsDown,
2849
2870
  markdownTagRenderers,
2850
- children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "suggestions", children: currentSuggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2851
- Suggestion,
2871
+ children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2872
+ RenderSuggestionsList,
2852
2873
  {
2853
- title: suggestion.title,
2854
- message: suggestion.message,
2855
- partial: suggestion.partial,
2856
- className: suggestion.className,
2857
- onClick: (message) => handleSendMessage(message)
2858
- },
2859
- index
2860
- )) })
2874
+ onSuggestionClick: handleSendMessage,
2875
+ suggestions: currentSuggestions
2876
+ }
2877
+ )
2861
2878
  }
2862
2879
  ),
2863
- imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
2864
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageUploadQueue, { images: selectedImages, onRemoveImage: removeSelectedImage }),
2865
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2880
+ imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
2881
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageUploadQueue, { images: selectedImages, onRemoveImage: removeSelectedImage }),
2882
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2866
2883
  "input",
2867
2884
  {
2868
2885
  type: "file",
@@ -2874,7 +2891,7 @@ function CopilotChat({
2874
2891
  }
2875
2892
  )
2876
2893
  ] }),
2877
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2894
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2878
2895
  Input2,
2879
2896
  {
2880
2897
  inProgress: isLoading,
@@ -2897,10 +2914,10 @@ function WrappedCopilotChat({
2897
2914
  }) {
2898
2915
  const chatContext = import_react13.default.useContext(ChatContext);
2899
2916
  if (!chatContext) {
2900
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
2901
- }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children }) });
2917
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
2918
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children }) });
2902
2919
  }
2903
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children });
2920
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children });
2904
2921
  }
2905
2922
  var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
2906
2923
  var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
@@ -3085,56 +3102,85 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
3085
3102
  };
3086
3103
 
3087
3104
  // src/components/chat/Modal.tsx
3088
- var import_jsx_runtime26 = require("react/jsx-runtime");
3089
- var CopilotModal = ({
3090
- instructions,
3091
- defaultOpen = false,
3092
- clickOutsideToClose = true,
3093
- hitEscapeToClose = true,
3094
- onSetOpen,
3095
- onSubmitMessage,
3096
- onStopGeneration,
3097
- onReloadMessages,
3098
- shortcut = "/",
3099
- icons,
3100
- labels,
3101
- makeSystemMessage,
3102
- onInProgress,
3103
- Window: Window2 = Window,
3104
- Button: Button2 = Button,
3105
- Header: Header2 = Header,
3106
- Messages: Messages2 = Messages,
3107
- Input: Input2 = Input,
3108
- AssistantMessage: AssistantMessage2 = AssistantMessage,
3109
- UserMessage: UserMessage2 = UserMessage,
3110
- onThumbsUp,
3111
- onThumbsDown,
3112
- onCopy,
3113
- onRegenerate,
3114
- markdownTagRenderers,
3115
- className,
3116
- children
3117
- }) => {
3105
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3106
+ var CopilotModal = (_a) => {
3107
+ var _b = _a, {
3108
+ instructions,
3109
+ defaultOpen = false,
3110
+ clickOutsideToClose = true,
3111
+ hitEscapeToClose = true,
3112
+ onSetOpen,
3113
+ onSubmitMessage,
3114
+ onStopGeneration,
3115
+ onReloadMessages,
3116
+ shortcut = "/",
3117
+ icons,
3118
+ labels,
3119
+ makeSystemMessage,
3120
+ onInProgress,
3121
+ Window: Window2 = Window,
3122
+ Button: Button2 = Button,
3123
+ Header: Header2 = Header,
3124
+ Messages: Messages2 = Messages,
3125
+ Input: Input2 = Input,
3126
+ AssistantMessage: AssistantMessage2 = AssistantMessage,
3127
+ UserMessage: UserMessage2 = UserMessage,
3128
+ onThumbsUp,
3129
+ onThumbsDown,
3130
+ onCopy,
3131
+ onRegenerate,
3132
+ markdownTagRenderers,
3133
+ className,
3134
+ children
3135
+ } = _b, props = __objRest(_b, [
3136
+ "instructions",
3137
+ "defaultOpen",
3138
+ "clickOutsideToClose",
3139
+ "hitEscapeToClose",
3140
+ "onSetOpen",
3141
+ "onSubmitMessage",
3142
+ "onStopGeneration",
3143
+ "onReloadMessages",
3144
+ "shortcut",
3145
+ "icons",
3146
+ "labels",
3147
+ "makeSystemMessage",
3148
+ "onInProgress",
3149
+ "Window",
3150
+ "Button",
3151
+ "Header",
3152
+ "Messages",
3153
+ "Input",
3154
+ "AssistantMessage",
3155
+ "UserMessage",
3156
+ "onThumbsUp",
3157
+ "onThumbsDown",
3158
+ "onCopy",
3159
+ "onRegenerate",
3160
+ "markdownTagRenderers",
3161
+ "className",
3162
+ "children"
3163
+ ]);
3118
3164
  const [openState, setOpenState] = import_react14.default.useState(defaultOpen);
3119
3165
  const setOpen = (open) => {
3120
3166
  onSetOpen == null ? void 0 : onSetOpen(open);
3121
3167
  setOpenState(open);
3122
3168
  };
3123
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
3169
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
3124
3170
  children,
3125
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className, children: [
3126
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button2, {}),
3127
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3171
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className, children: [
3172
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button2, {}),
3173
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3128
3174
  Window2,
3129
3175
  {
3130
3176
  clickOutsideToClose,
3131
3177
  shortcut,
3132
3178
  hitEscapeToClose,
3133
3179
  children: [
3134
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Header2, {}),
3135
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3180
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Header2, {}),
3181
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3136
3182
  CopilotChat,
3137
- {
3183
+ __spreadProps(__spreadValues({}, props), {
3138
3184
  instructions,
3139
3185
  onSubmitMessage,
3140
3186
  onStopGeneration,
@@ -3150,7 +3196,7 @@ var CopilotModal = ({
3150
3196
  onCopy,
3151
3197
  onRegenerate,
3152
3198
  markdownTagRenderers
3153
- }
3199
+ })
3154
3200
  )
3155
3201
  ]
3156
3202
  }
@@ -3160,17 +3206,17 @@ var CopilotModal = ({
3160
3206
  };
3161
3207
 
3162
3208
  // src/components/chat/Popup.tsx
3163
- var import_jsx_runtime27 = require("react/jsx-runtime");
3209
+ var import_jsx_runtime28 = require("react/jsx-runtime");
3164
3210
  function CopilotPopup(props) {
3165
3211
  props = __spreadProps(__spreadValues({}, props), {
3166
3212
  className: props.className ? props.className + " copilotKitPopup" : "copilotKitPopup"
3167
3213
  });
3168
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CopilotModal, __spreadProps(__spreadValues({}, props), { children: props.children }));
3214
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CopilotModal, __spreadProps(__spreadValues({}, props), { children: props.children }));
3169
3215
  }
3170
3216
 
3171
3217
  // src/components/chat/Sidebar.tsx
3172
3218
  var import_react15 = require("react");
3173
- var import_jsx_runtime28 = require("react/jsx-runtime");
3219
+ var import_jsx_runtime29 = require("react/jsx-runtime");
3174
3220
  function CopilotSidebar(props) {
3175
3221
  props = __spreadProps(__spreadValues({}, props), {
3176
3222
  className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
@@ -3183,7 +3229,7 @@ function CopilotSidebar(props) {
3183
3229
  (_a = props.onSetOpen) == null ? void 0 : _a.call(props, open);
3184
3230
  setExpandedClassName(open ? "sidebarExpanded" : "");
3185
3231
  };
3186
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CopilotModal, __spreadProps(__spreadValues(__spreadValues({}, props), { onSetOpen }), { children: props.children })) });
3232
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CopilotModal, __spreadProps(__spreadValues(__spreadValues({}, props), { onSetOpen }), { children: props.children })) });
3187
3233
  }
3188
3234
  // Annotate the CommonJS export names for ESM import in node:
3189
3235
  0 && (module.exports = {
@@ -3194,6 +3240,8 @@ function CopilotSidebar(props) {
3194
3240
  CopilotSidebar,
3195
3241
  Markdown,
3196
3242
  RenderImageMessage,
3243
+ RenderSuggestion,
3244
+ RenderSuggestionsList,
3197
3245
  UserMessage,
3198
3246
  shouldShowDevConsole,
3199
3247
  useChatContext