@copilotkit/react-ui 1.1.3-feat-runtime-remote-actions.2 → 1.2.1

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 (212) hide show
  1. package/CHANGELOG.md +21 -19
  2. package/dist/components/chat/Button.d.mts +7 -0
  3. package/dist/components/chat/Button.js.map +1 -1
  4. package/dist/components/chat/Button.mjs +30 -6
  5. package/dist/components/chat/Button.mjs.map +1 -1
  6. package/dist/components/chat/Chat.d.mts +87 -0
  7. package/dist/components/chat/Chat.d.ts +2 -2
  8. package/dist/components/chat/Chat.js +8 -107
  9. package/dist/components/chat/Chat.js.map +1 -1
  10. package/dist/components/chat/Chat.mjs +1754 -20
  11. package/dist/components/chat/Chat.mjs.map +1 -1
  12. package/dist/components/chat/ChatContext.d.mts +105 -0
  13. package/dist/components/chat/ChatContext.d.ts +1 -1
  14. package/dist/components/chat/ChatContext.mjs +228 -7
  15. package/dist/components/chat/ChatContext.mjs.map +1 -1
  16. package/dist/components/chat/CodeBlock.d.mts +14 -0
  17. package/dist/components/chat/CodeBlock.js +1 -2
  18. package/dist/components/chat/CodeBlock.js.map +1 -1
  19. package/dist/components/chat/CodeBlock.mjs +482 -8
  20. package/dist/components/chat/CodeBlock.mjs.map +1 -1
  21. package/dist/components/chat/Header.d.mts +7 -0
  22. package/dist/components/chat/Header.mjs +23 -6
  23. package/dist/components/chat/Header.mjs.map +1 -1
  24. package/dist/components/chat/Icons.d.mts +18 -0
  25. package/dist/components/chat/Icons.mjs +271 -16
  26. package/dist/components/chat/Icons.mjs.map +1 -1
  27. package/dist/components/chat/Input.d.mts +7 -0
  28. package/dist/components/chat/Input.js +2 -4
  29. package/dist/components/chat/Input.js.map +1 -1
  30. package/dist/components/chat/Input.mjs +255 -8
  31. package/dist/components/chat/Input.mjs.map +1 -1
  32. package/dist/components/chat/Markdown.d.mts +8 -0
  33. package/dist/components/chat/Markdown.js +1 -2
  34. package/dist/components/chat/Markdown.js.map +1 -1
  35. package/dist/components/chat/Markdown.mjs +546 -7
  36. package/dist/components/chat/Markdown.mjs.map +1 -1
  37. package/dist/components/chat/Messages.d.mts +7 -0
  38. package/dist/components/chat/Messages.js +3 -48
  39. package/dist/components/chat/Messages.js.map +1 -1
  40. package/dist/components/chat/Messages.mjs +678 -8
  41. package/dist/components/chat/Messages.mjs.map +1 -1
  42. package/dist/components/chat/Modal.d.mts +51 -0
  43. package/dist/components/chat/Modal.d.ts +1 -1
  44. package/dist/components/chat/Modal.js +9 -107
  45. package/dist/components/chat/Modal.js.map +1 -1
  46. package/dist/components/chat/Modal.mjs +1956 -22
  47. package/dist/components/chat/Modal.mjs.map +1 -1
  48. package/dist/components/chat/Popup.d.mts +13 -0
  49. package/dist/components/chat/Popup.js +9 -107
  50. package/dist/components/chat/Popup.js.map +1 -1
  51. package/dist/components/chat/Popup.mjs +1965 -23
  52. package/dist/components/chat/Popup.mjs.map +1 -1
  53. package/dist/components/chat/Response.d.mts +7 -0
  54. package/dist/components/chat/Response.mjs +23 -6
  55. package/dist/components/chat/Response.mjs.map +1 -1
  56. package/dist/components/chat/Sidebar.d.mts +13 -0
  57. package/dist/components/chat/Sidebar.js +10 -107
  58. package/dist/components/chat/Sidebar.js.map +1 -1
  59. package/dist/components/chat/Sidebar.mjs +1977 -23
  60. package/dist/components/chat/Sidebar.mjs.map +1 -1
  61. package/dist/components/chat/Suggestion.d.mts +14 -0
  62. package/dist/components/chat/Suggestion.js.map +1 -1
  63. package/dist/components/chat/Suggestion.mjs +152 -5
  64. package/dist/components/chat/Suggestion.mjs.map +1 -1
  65. package/dist/components/chat/Textarea.d.mts +13 -0
  66. package/dist/components/chat/Textarea.js.map +1 -1
  67. package/dist/components/chat/Textarea.mjs +48 -4
  68. package/dist/components/chat/Textarea.mjs.map +1 -1
  69. package/dist/components/chat/Window.d.mts +7 -0
  70. package/dist/components/chat/Window.js.map +1 -1
  71. package/dist/components/chat/Window.mjs +125 -6
  72. package/dist/components/chat/Window.mjs.map +1 -1
  73. package/dist/components/chat/index.d.mts +11 -0
  74. package/dist/components/chat/index.js +10 -107
  75. package/dist/components/chat/index.js.map +1 -1
  76. package/dist/components/chat/index.mjs +1983 -31
  77. package/dist/components/chat/index.mjs.map +1 -1
  78. package/dist/components/chat/props.d.mts +35 -0
  79. package/dist/components/chat/props.d.ts +1 -1
  80. package/dist/components/chat/props.mjs +0 -1
  81. package/dist/components/dev-console/console.d.mts +10 -0
  82. package/dist/components/dev-console/console.js +0 -52
  83. package/dist/components/dev-console/console.js.map +1 -1
  84. package/dist/components/dev-console/console.mjs +426 -8
  85. package/dist/components/dev-console/console.mjs.map +1 -1
  86. package/dist/components/dev-console/icons.d.mts +9 -0
  87. package/dist/components/dev-console/icons.mjs +83 -8
  88. package/dist/components/dev-console/icons.mjs.map +1 -1
  89. package/dist/components/dev-console/index.d.mts +5 -0
  90. package/dist/components/dev-console/index.js +0 -52
  91. package/dist/components/dev-console/index.js.map +1 -1
  92. package/dist/components/dev-console/index.mjs +424 -10
  93. package/dist/components/dev-console/index.mjs.map +1 -1
  94. package/dist/components/dev-console/types.d.mts +9 -0
  95. package/dist/components/dev-console/types.d.ts +1 -1
  96. package/dist/components/dev-console/utils.d.mts +9 -0
  97. package/dist/components/dev-console/utils.d.ts +1 -2
  98. package/dist/components/dev-console/utils.js +0 -53
  99. package/dist/components/dev-console/utils.js.map +1 -1
  100. package/dist/components/dev-console/utils.mjs +103 -9
  101. package/dist/components/dev-console/utils.mjs.map +1 -1
  102. package/dist/components/index.d.mts +11 -0
  103. package/dist/components/index.js +10 -107
  104. package/dist/components/index.js.map +1 -1
  105. package/dist/components/index.mjs +1983 -32
  106. package/dist/components/index.mjs.map +1 -1
  107. package/dist/context/index.d.mts +2 -0
  108. package/dist/context/index.d.ts +1 -1
  109. package/dist/context/index.mjs +0 -1
  110. package/dist/hooks/index.d.mts +1 -0
  111. package/dist/hooks/index.mjs +24 -5
  112. package/dist/hooks/index.mjs.map +1 -1
  113. package/dist/hooks/use-copilot-chat-suggestions.d.mts +83 -0
  114. package/dist/hooks/use-copilot-chat-suggestions.mjs +24 -4
  115. package/dist/hooks/use-copilot-chat-suggestions.mjs.map +1 -1
  116. package/dist/hooks/use-copy-to-clipboard.d.mts +9 -0
  117. package/dist/hooks/use-copy-to-clipboard.d.ts +1 -1
  118. package/dist/hooks/use-copy-to-clipboard.mjs +21 -4
  119. package/dist/hooks/use-copy-to-clipboard.mjs.map +1 -1
  120. package/dist/hooks/use-push-to-talk.d.mts +19 -0
  121. package/dist/hooks/use-push-to-talk.d.ts +1 -1
  122. package/dist/hooks/use-push-to-talk.js.map +1 -1
  123. package/dist/hooks/use-push-to-talk.mjs +148 -6
  124. package/dist/hooks/use-push-to-talk.mjs.map +1 -1
  125. package/dist/index.css +1 -747
  126. package/dist/index.d.mts +13 -0
  127. package/dist/index.js +17 -107
  128. package/dist/index.js.map +1 -1
  129. package/dist/index.mjs +2015 -38
  130. package/dist/index.mjs.map +1 -1
  131. package/dist/lib/utils.d.mts +4 -0
  132. package/dist/lib/utils.mjs +20 -3
  133. package/dist/lib/utils.mjs.map +1 -1
  134. package/dist/lib/utils.test.d.mts +2 -0
  135. package/dist/lib/utils.test.d.ts +1 -1
  136. package/dist/types/css.d.mts +16 -0
  137. package/dist/types/css.d.ts +1 -1
  138. package/dist/types/index.d.mts +2 -0
  139. package/dist/types/index.mjs +0 -1
  140. package/dist/types/suggestions.d.mts +8 -0
  141. package/dist/types/suggestions.d.ts +1 -1
  142. package/package.json +19 -11
  143. package/src/components/chat/Chat.tsx +2 -5
  144. package/src/components/chat/Messages.tsx +2 -83
  145. package/src/components/chat/Modal.tsx +1 -0
  146. package/src/components/chat/Popup.tsx +1 -4
  147. package/src/components/chat/Sidebar.tsx +2 -3
  148. package/src/components/chat/Suggestion.tsx +0 -2
  149. package/src/components/dev-console/console.tsx +0 -6
  150. package/src/components/dev-console/utils.ts +0 -56
  151. package/tsup.config.ts +59 -15
  152. package/dist/chunk-54JAUBUJ.mjs +0 -26
  153. package/dist/chunk-54JAUBUJ.mjs.map +0 -1
  154. package/dist/chunk-5HHVL5WK.mjs +0 -29
  155. package/dist/chunk-5HHVL5WK.mjs.map +0 -1
  156. package/dist/chunk-B2KQEX2R.mjs +0 -91
  157. package/dist/chunk-B2KQEX2R.mjs.map +0 -1
  158. package/dist/chunk-BJPGMY3I.mjs +0 -70
  159. package/dist/chunk-BJPGMY3I.mjs.map +0 -1
  160. package/dist/chunk-EFZPSZWO.mjs +0 -1
  161. package/dist/chunk-EFZPSZWO.mjs.map +0 -1
  162. package/dist/chunk-FL4ETWFB.mjs +0 -21
  163. package/dist/chunk-FL4ETWFB.mjs.map +0 -1
  164. package/dist/chunk-FLV3J3VX.mjs +0 -18
  165. package/dist/chunk-FLV3J3VX.mjs.map +0 -1
  166. package/dist/chunk-FO7Z5LAL.mjs +0 -118
  167. package/dist/chunk-FO7Z5LAL.mjs.map +0 -1
  168. package/dist/chunk-FOZVHL73.mjs +0 -171
  169. package/dist/chunk-FOZVHL73.mjs.map +0 -1
  170. package/dist/chunk-FZC7X5PK.mjs +0 -262
  171. package/dist/chunk-FZC7X5PK.mjs.map +0 -1
  172. package/dist/chunk-H7TM5JE6.mjs +0 -146
  173. package/dist/chunk-H7TM5JE6.mjs.map +0 -1
  174. package/dist/chunk-HR36Y2FQ.mjs +0 -167
  175. package/dist/chunk-HR36Y2FQ.mjs.map +0 -1
  176. package/dist/chunk-I4QG2ZZU.mjs +0 -220
  177. package/dist/chunk-I4QG2ZZU.mjs.map +0 -1
  178. package/dist/chunk-IU3WTXLQ.mjs +0 -1
  179. package/dist/chunk-IU3WTXLQ.mjs.map +0 -1
  180. package/dist/chunk-JD7BAH7U.mjs +0 -1
  181. package/dist/chunk-JD7BAH7U.mjs.map +0 -1
  182. package/dist/chunk-MRFF7GSQ.mjs +0 -1
  183. package/dist/chunk-MRFF7GSQ.mjs.map +0 -1
  184. package/dist/chunk-MRXNTQOX.mjs +0 -59
  185. package/dist/chunk-MRXNTQOX.mjs.map +0 -1
  186. package/dist/chunk-OTPAZXVR.mjs +0 -92
  187. package/dist/chunk-OTPAZXVR.mjs.map +0 -1
  188. package/dist/chunk-QOEAEMUQ.mjs +0 -30
  189. package/dist/chunk-QOEAEMUQ.mjs.map +0 -1
  190. package/dist/chunk-T26KLXLH.mjs +0 -1
  191. package/dist/chunk-T26KLXLH.mjs.map +0 -1
  192. package/dist/chunk-U6J5DGOE.mjs +0 -83
  193. package/dist/chunk-U6J5DGOE.mjs.map +0 -1
  194. package/dist/chunk-UPTB2MVO.mjs +0 -395
  195. package/dist/chunk-UPTB2MVO.mjs.map +0 -1
  196. package/dist/chunk-V7W6IM2V.mjs +0 -1
  197. package/dist/chunk-V7W6IM2V.mjs.map +0 -1
  198. package/dist/chunk-VOBX4JOA.mjs +0 -138
  199. package/dist/chunk-VOBX4JOA.mjs.map +0 -1
  200. package/dist/chunk-WB3YULQ4.mjs +0 -1
  201. package/dist/chunk-WB3YULQ4.mjs.map +0 -1
  202. package/dist/chunk-WCPLXRZX.mjs +0 -106
  203. package/dist/chunk-WCPLXRZX.mjs.map +0 -1
  204. package/dist/chunk-XSUSSWDS.mjs +0 -18
  205. package/dist/chunk-XSUSSWDS.mjs.map +0 -1
  206. package/dist/chunk-YOH25I6N.mjs +0 -25
  207. package/dist/chunk-YOH25I6N.mjs.map +0 -1
  208. package/dist/chunk-YQ3D5IQV.mjs +0 -75
  209. package/dist/chunk-YQ3D5IQV.mjs.map +0 -1
  210. package/dist/chunk-YQFVRDNC.mjs +0 -53
  211. package/dist/chunk-YQFVRDNC.mjs.map +0 -1
  212. package/dist/index.css.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,40 +1,42 @@
1
1
  # ui
2
2
 
3
- ## 1.1.3-feat-runtime-remote-actions.2
3
+ ## 1.2.1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Better message grouping
8
- - Updated dependencies
9
- - @copilotkit/runtime-client-gql@1.1.3-feat-runtime-remote-actions.2
10
- - @copilotkit/react-core@1.1.3-feat-runtime-remote-actions.2
11
- - @copilotkit/shared@1.1.3-feat-runtime-remote-actions.2
12
-
13
- ## 1.1.3-feat-runtime-remote-actions.1
7
+ - inject minified css in bundle
14
8
 
15
- ### Patch Changes
9
+ - removes the need to import `styles.css` manually
10
+ - empty `styles.css` included in the build for backwards compatibility
11
+ - uses tsup's `injectStyles` with `postcss` to bundle and minify the CSS, then inject it as a style tag
12
+ - currently uses my fork of `tsup` where I added support for async function in `injectStyles` (must-have for postcss), a PR from my fork to the main library will follow shortly
13
+ - remove material-ui, and use `react-icons` for icons (same icons as before)
14
+ - remove unused `IncludedFilesPreview` component
15
+ - updated docs
16
16
 
17
- - Reduce request size by skipping intermediate state
18
17
  - Updated dependencies
19
- - @copilotkit/runtime-client-gql@1.1.3-feat-runtime-remote-actions.1
20
- - @copilotkit/react-core@1.1.3-feat-runtime-remote-actions.1
21
- - @copilotkit/shared@1.1.3-feat-runtime-remote-actions.1
18
+ - @copilotkit/react-core@1.2.1
19
+ - @copilotkit/runtime-client-gql@1.2.1
20
+ - @copilotkit/shared@1.2.1
21
+
22
+ ## 1.2.0
22
23
 
23
- ## 1.1.3-feat-runtime-remote-actions.0
24
+ ### Minor Changes
25
+
26
+ - Fix errors related to crypto not being found, and other bug fixes
24
27
 
25
28
  ### Patch Changes
26
29
 
27
30
  - 638d51d: appendMessage fix 1
28
- - Rename hooks and bugfixes
29
31
  - faccbe1: state-abuse resistance for useCopilotChat
30
32
  - b0cf700: remove unnecessary logging
31
- - Updated dependencies [638d51d]
32
33
  - Updated dependencies
34
+ - Updated dependencies [638d51d]
33
35
  - Updated dependencies [faccbe1]
34
36
  - Updated dependencies [b0cf700]
35
- - @copilotkit/react-core@1.1.3-feat-runtime-remote-actions.0
36
- - @copilotkit/runtime-client-gql@1.1.3-feat-runtime-remote-actions.0
37
- - @copilotkit/shared@1.1.3-feat-runtime-remote-actions.0
37
+ - @copilotkit/react-core@1.2.0
38
+ - @copilotkit/runtime-client-gql@1.2.0
39
+ - @copilotkit/shared@1.2.0
38
40
 
39
41
  ## 1.1.2
40
42
 
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ButtonProps } from './props.mjs';
3
+ import '@copilotkit/runtime-client-gql';
4
+
5
+ declare const Button: ({}: ButtonProps) => react_jsx_runtime.JSX.Element;
6
+
7
+ export { Button };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/chat/Button.tsx","../../../src/components/chat/ChatContext.tsx"],"sourcesContent":["import { ButtonProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\n\nexport const Button = ({}: ButtonProps) => {\n const { open, setOpen, icons } = useChatContext();\n\n return (\n <div onClick={() => setOpen(!open)}>\n <button\n className={`copilotKitButton ${open ? \"open\" : \"\"}`}\n aria-label={open ? \"Close Chat\" : \"Open Chat\"}\n >\n <div className=\"copilotKitButtonIcon copilotKitButtonIconOpen\">{icons.openIcon}</div>\n <div className=\"copilotKitButtonIcon copilotKitButtonIconClose\">{icons.closeIcon}</div>\n </button>\n </div>\n );\n};\n","import React, { useMemo, useState } from \"react\";\nimport * as DefaultIcons from \"./Icons\";\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode;\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode;\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode;\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode;\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode;\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode;\n\n /**\n * The icons to use for push to talk.\n * @default <PushToTalkIcon />\n */\n\n pushToTalkIcon?: React.ReactNode;\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[];\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string;\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string;\n\n /**\n * The message to display when an error occurs.\n * @default \"❌ An error occurred. Please try again.\"\n */\n error?: string;\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string;\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string;\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>;\n icons: Required<CopilotChatIcons>;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined);\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext);\n if (context === undefined) {\n throw new Error(\n \"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?\",\n );\n }\n return context;\n}\n\ninterface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels;\n icons?: CopilotChatIcons;\n children?: React.ReactNode;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContextProvider = ({\n // temperature,\n // instructions,\n // maxFeedback,\n labels,\n icons,\n children,\n open,\n setOpen,\n}: ChatContextProps) => {\n const context = {\n labels: {\n ...{\n initial: \"\",\n title: \"CopilotKit\",\n placeholder: \"Type a message...\",\n error: \"❌ An error occurred. Please try again.\",\n stopGenerating: \"Stop generating\",\n regenerateResponse: \"Regenerate response\",\n },\n ...labels,\n },\n\n icons: {\n ...{\n openIcon: DefaultIcons.OpenIcon,\n closeIcon: DefaultIcons.CloseIcon,\n headerCloseIcon: DefaultIcons.HeaderCloseIcon,\n sendIcon: DefaultIcons.SendIcon,\n activityIcon: DefaultIcons.ActivityIcon,\n spinnerIcon: DefaultIcons.SpinnerIcon,\n stopIcon: DefaultIcons.StopIcon,\n regenerateIcon: DefaultIcons.RegenerateIcon,\n pushToTalkIcon: DefaultIcons.PushToTalkIcon,\n },\n ...icons,\n },\n open,\n setOpen,\n };\n return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAyC;AA6KhC;AA/DF,IAAM,cAAc,aAAAA,QAAM,cAAuC,MAAS;AAE1E,SAAS,iBAA8B;AAC5C,QAAM,UAAU,aAAAA,QAAM,WAAW,WAAW;AAC5C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;;;ADhHM,IAAAC,sBAAA;AALC,IAAM,SAAS,CAAC,CAAC,MAAmB;AACzC,QAAM,EAAE,MAAM,SAAS,MAAM,IAAI,eAAe;AAEhD,SACE,6CAAC,SAAI,SAAS,MAAM,QAAQ,CAAC,IAAI,GAC/B;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,oBAAoB,OAAO,SAAS;AAAA,MAC/C,cAAY,OAAO,eAAe;AAAA,MAElC;AAAA,qDAAC,SAAI,WAAU,iDAAiD,gBAAM,UAAS;AAAA,QAC/E,6CAAC,SAAI,WAAU,kDAAkD,gBAAM,WAAU;AAAA;AAAA;AAAA,EACnF,GACF;AAEJ;","names":["React","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../../src/components/chat/Button.tsx","../../../src/components/chat/ChatContext.tsx"],"sourcesContent":["import { ButtonProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\n\nexport const Button = ({}: ButtonProps) => {\n const { open, setOpen, icons } = useChatContext();\n\n return (\n <div onClick={() => setOpen(!open)}>\n <button\n className={`copilotKitButton ${open ? \"open\" : \"\"}`}\n aria-label={open ? \"Close Chat\" : \"Open Chat\"}\n >\n <div className=\"copilotKitButtonIcon copilotKitButtonIconOpen\">{icons.openIcon}</div>\n <div className=\"copilotKitButtonIcon copilotKitButtonIconClose\">{icons.closeIcon}</div>\n </button>\n </div>\n );\n};\n","import React, { useMemo, useState } from \"react\";\nimport * as DefaultIcons from \"./Icons\";\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode;\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode;\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode;\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode;\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode;\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode;\n\n /**\n * The icons to use for push to talk.\n * @default <PushToTalkIcon />\n */\n\n pushToTalkIcon?: React.ReactNode;\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[];\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string;\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string;\n\n /**\n * The message to display when an error occurs.\n * @default \"❌ An error occurred. Please try again.\"\n */\n error?: string;\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string;\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string;\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>;\n icons: Required<CopilotChatIcons>;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined);\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext);\n if (context === undefined) {\n throw new Error(\n \"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?\",\n );\n }\n return context;\n}\n\ninterface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels;\n icons?: CopilotChatIcons;\n children?: React.ReactNode;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContextProvider = ({\n // temperature,\n // instructions,\n // maxFeedback,\n labels,\n icons,\n children,\n open,\n setOpen,\n}: ChatContextProps) => {\n const context = {\n labels: {\n ...{\n initial: \"\",\n title: \"CopilotKit\",\n placeholder: \"Type a message...\",\n error: \"❌ An error occurred. Please try again.\",\n stopGenerating: \"Stop generating\",\n regenerateResponse: \"Regenerate response\",\n },\n ...labels,\n },\n\n icons: {\n ...{\n openIcon: DefaultIcons.OpenIcon,\n closeIcon: DefaultIcons.CloseIcon,\n headerCloseIcon: DefaultIcons.HeaderCloseIcon,\n sendIcon: DefaultIcons.SendIcon,\n activityIcon: DefaultIcons.ActivityIcon,\n spinnerIcon: DefaultIcons.SpinnerIcon,\n stopIcon: DefaultIcons.StopIcon,\n regenerateIcon: DefaultIcons.RegenerateIcon,\n pushToTalkIcon: DefaultIcons.PushToTalkIcon,\n },\n ...icons,\n },\n open,\n setOpen,\n };\n return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAyC;AA6KhC;AA/DF,IAAM,cAAc,aAAAA,QAAM,cAAuC,MAAS;AAE1E,SAAS,iBAA8B;AAC5C,QAAM,UAAU,aAAAA,QAAM,WAAW,WAAW;AAC5C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;;;ADhHM,IAAAC,sBAAA;AALC,IAAM,SAAS,CAAC,CAAC,MAAmB;AACzC,QAAM,EAAE,MAAM,SAAS,MAAM,IAAI,eAAe;AAEhD,SACE,6CAAC,SAAI,SAAS,MAAM,QAAQ,CAAC,IAAI,GAC/B;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,oBAAoB,OAAO,SAAS,EAAE;AAAA,MACjD,cAAY,OAAO,eAAe;AAAA,MAElC;AAAA,qDAAC,SAAI,WAAU,iDAAiD,gBAAM,UAAS;AAAA,QAC/E,6CAAC,SAAI,WAAU,kDAAkD,gBAAM,WAAU;AAAA;AAAA;AAAA,EACnF,GACF;AAEJ;","names":["React","import_jsx_runtime"]}
@@ -1,9 +1,33 @@
1
- import {
2
- Button
3
- } from "../../chunk-YOH25I6N.mjs";
4
- import "../../chunk-BJPGMY3I.mjs";
5
- import "../../chunk-FZC7X5PK.mjs";
6
- import "../../chunk-MRXNTQOX.mjs";
1
+ // src/components/chat/ChatContext.tsx
2
+ import React from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ var ChatContext = React.createContext(void 0);
5
+ function useChatContext() {
6
+ const context = React.useContext(ChatContext);
7
+ if (context === void 0) {
8
+ throw new Error(
9
+ "Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?"
10
+ );
11
+ }
12
+ return context;
13
+ }
14
+
15
+ // src/components/chat/Button.tsx
16
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
17
+ var Button = ({}) => {
18
+ const { open, setOpen, icons } = useChatContext();
19
+ return /* @__PURE__ */ jsx2("div", { onClick: () => setOpen(!open), children: /* @__PURE__ */ jsxs(
20
+ "button",
21
+ {
22
+ className: `copilotKitButton ${open ? "open" : ""}`,
23
+ "aria-label": open ? "Close Chat" : "Open Chat",
24
+ children: [
25
+ /* @__PURE__ */ jsx2("div", { className: "copilotKitButtonIcon copilotKitButtonIconOpen", children: icons.openIcon }),
26
+ /* @__PURE__ */ jsx2("div", { className: "copilotKitButtonIcon copilotKitButtonIconClose", children: icons.closeIcon })
27
+ ]
28
+ }
29
+ ) });
30
+ };
7
31
  export {
8
32
  Button
9
33
  };
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../../../src/components/chat/ChatContext.tsx","../../../src/components/chat/Button.tsx"],"sourcesContent":["import React, { useMemo, useState } from \"react\";\nimport * as DefaultIcons from \"./Icons\";\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode;\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode;\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode;\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode;\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode;\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode;\n\n /**\n * The icons to use for push to talk.\n * @default <PushToTalkIcon />\n */\n\n pushToTalkIcon?: React.ReactNode;\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[];\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string;\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string;\n\n /**\n * The message to display when an error occurs.\n * @default \"❌ An error occurred. Please try again.\"\n */\n error?: string;\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string;\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string;\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>;\n icons: Required<CopilotChatIcons>;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined);\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext);\n if (context === undefined) {\n throw new Error(\n \"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?\",\n );\n }\n return context;\n}\n\ninterface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels;\n icons?: CopilotChatIcons;\n children?: React.ReactNode;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContextProvider = ({\n // temperature,\n // instructions,\n // maxFeedback,\n labels,\n icons,\n children,\n open,\n setOpen,\n}: ChatContextProps) => {\n const context = {\n labels: {\n ...{\n initial: \"\",\n title: \"CopilotKit\",\n placeholder: \"Type a message...\",\n error: \"❌ An error occurred. Please try again.\",\n stopGenerating: \"Stop generating\",\n regenerateResponse: \"Regenerate response\",\n },\n ...labels,\n },\n\n icons: {\n ...{\n openIcon: DefaultIcons.OpenIcon,\n closeIcon: DefaultIcons.CloseIcon,\n headerCloseIcon: DefaultIcons.HeaderCloseIcon,\n sendIcon: DefaultIcons.SendIcon,\n activityIcon: DefaultIcons.ActivityIcon,\n spinnerIcon: DefaultIcons.SpinnerIcon,\n stopIcon: DefaultIcons.StopIcon,\n regenerateIcon: DefaultIcons.RegenerateIcon,\n pushToTalkIcon: DefaultIcons.PushToTalkIcon,\n },\n ...icons,\n },\n open,\n setOpen,\n };\n return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;\n};\n","import { ButtonProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\n\nexport const Button = ({}: ButtonProps) => {\n const { open, setOpen, icons } = useChatContext();\n\n return (\n <div onClick={() => setOpen(!open)}>\n <button\n className={`copilotKitButton ${open ? \"open\" : \"\"}`}\n aria-label={open ? \"Close Chat\" : \"Open Chat\"}\n >\n <div className=\"copilotKitButtonIcon copilotKitButtonIconOpen\">{icons.openIcon}</div>\n <div className=\"copilotKitButtonIcon copilotKitButtonIconClose\">{icons.closeIcon}</div>\n </button>\n </div>\n );\n};\n"],"mappings":";AAAA,OAAO,WAAkC;AA6KhC;AA/DF,IAAM,cAAc,MAAM,cAAuC,MAAS;AAE1E,SAAS,iBAA8B;AAC5C,QAAM,UAAU,MAAM,WAAW,WAAW;AAC5C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;;;AChHM,SAIE,OAAAA,MAJF;AALC,IAAM,SAAS,CAAC,CAAC,MAAmB;AACzC,QAAM,EAAE,MAAM,SAAS,MAAM,IAAI,eAAe;AAEhD,SACE,gBAAAA,KAAC,SAAI,SAAS,MAAM,QAAQ,CAAC,IAAI,GAC/B;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,oBAAoB,OAAO,SAAS,EAAE;AAAA,MACjD,cAAY,OAAO,eAAe;AAAA,MAElC;AAAA,wBAAAA,KAAC,SAAI,WAAU,iDAAiD,gBAAM,UAAS;AAAA,QAC/E,gBAAAA,KAAC,SAAI,WAAU,kDAAkD,gBAAM,WAAU;AAAA;AAAA;AAAA,EACnF,GACF;AAEJ;","names":["jsx"]}
@@ -0,0 +1,87 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { CopilotChatIcons, CopilotChatLabels } from './ChatContext.mjs';
3
+ import React__default from 'react';
4
+ import { SystemMessageFunction } from '@copilotkit/react-core';
5
+ import { CopilotChatSuggestion } from '../../types/suggestions.mjs';
6
+ import { Message } from '@copilotkit/runtime-client-gql';
7
+ import { MessagesProps, InputProps, ResponseButtonProps } from './props.mjs';
8
+
9
+ /**
10
+ * Props for CopilotChat component.
11
+ */
12
+ interface CopilotChatProps {
13
+ /**
14
+ * Custom instructions to be added to the system message. Use this property to
15
+ * provide additional context or guidance to the language model, influencing
16
+ * its responses. These instructions can include specific directions,
17
+ * preferences, or criteria that the model should consider when generating
18
+ * its output, thereby tailoring the conversation more precisely to the
19
+ * user's needs or the application's requirements.
20
+ */
21
+ instructions?: string;
22
+ /**
23
+ * A callback that gets called when the in progress state changes.
24
+ */
25
+ onInProgress?: (inProgress: boolean) => void;
26
+ /**
27
+ * A callback that gets called when a new message it submitted.
28
+ */
29
+ onSubmitMessage?: (message: string) => void | Promise<void>;
30
+ /**
31
+ * Icons can be used to set custom icons for the chat window.
32
+ */
33
+ icons?: CopilotChatIcons;
34
+ /**
35
+ * Labels can be used to set custom labels for the chat window.
36
+ */
37
+ labels?: CopilotChatLabels;
38
+ /**
39
+ * A function that takes in context string and instructions and returns
40
+ * the system message to include in the chat request.
41
+ * Use this to completely override the system message, when providing
42
+ * instructions is not enough.
43
+ */
44
+ makeSystemMessage?: SystemMessageFunction;
45
+ /**
46
+ * Whether to show the response button.
47
+ * @default true
48
+ */
49
+ showResponseButton?: boolean;
50
+ /**
51
+ * A custom Messages component to use instead of the default.
52
+ */
53
+ Messages?: React__default.ComponentType<MessagesProps>;
54
+ /**
55
+ * A custom Input component to use instead of the default.
56
+ */
57
+ Input?: React__default.ComponentType<InputProps>;
58
+ /**
59
+ * A custom ResponseButton component to use instead of the default.
60
+ */
61
+ ResponseButton?: React__default.ComponentType<ResponseButtonProps>;
62
+ /**
63
+ * A class name to apply to the root element.
64
+ */
65
+ className?: string;
66
+ /**
67
+ * Children to render.
68
+ */
69
+ children?: React__default.ReactNode;
70
+ }
71
+ declare function CopilotChat({ instructions, onSubmitMessage, makeSystemMessage, showResponseButton, onInProgress, Messages, Input, ResponseButton, className, icons, labels, }: CopilotChatProps): react_jsx_runtime.JSX.Element;
72
+ declare function WrappedCopilotChat({ children, icons, labels, className, }: {
73
+ children: React__default.ReactNode;
74
+ icons?: CopilotChatIcons;
75
+ labels?: CopilotChatLabels;
76
+ className?: string;
77
+ }): react_jsx_runtime.JSX.Element;
78
+ declare const useCopilotChatLogic: (makeSystemMessage?: SystemMessageFunction, onInProgress?: (isLoading: boolean) => void, onSubmitMessage?: (messageContent: string) => void) => {
79
+ visibleMessages: Message[];
80
+ isLoading: boolean;
81
+ currentSuggestions: CopilotChatSuggestion[];
82
+ sendMessage: (messageContent: string) => Promise<Message>;
83
+ stopGeneration: () => void;
84
+ reloadMessages: () => Promise<void>;
85
+ };
86
+
87
+ export { CopilotChat, type CopilotChatProps, WrappedCopilotChat, useCopilotChatLogic };
@@ -75,7 +75,7 @@ declare function WrappedCopilotChat({ children, icons, labels, className, }: {
75
75
  labels?: CopilotChatLabels;
76
76
  className?: string;
77
77
  }): react_jsx_runtime.JSX.Element;
78
- declare const useCopilotChatLogic: (makeSystemMessage?: SystemMessageFunction, onInProgress?: (isLoading: boolean) => void, onSubmitMessage?: (messageContent: string) => Promise<void> | void) => {
78
+ declare const useCopilotChatLogic: (makeSystemMessage?: SystemMessageFunction, onInProgress?: (isLoading: boolean) => void, onSubmitMessage?: (messageContent: string) => void) => {
79
79
  visibleMessages: Message[];
80
80
  isLoading: boolean;
81
81
  currentSuggestions: CopilotChatSuggestion[];
@@ -84,4 +84,4 @@ declare const useCopilotChatLogic: (makeSystemMessage?: SystemMessageFunction, o
84
84
  reloadMessages: () => Promise<void>;
85
85
  };
86
86
 
87
- export { CopilotChat, CopilotChatProps, WrappedCopilotChat, useCopilotChatLogic };
87
+ export { CopilotChat, type CopilotChatProps, WrappedCopilotChat, useCopilotChatLogic };
@@ -469,8 +469,7 @@ var CodeBlock = (0, import_react2.memo)(({ language, value }) => {
469
469
  URL.revokeObjectURL(url);
470
470
  };
471
471
  const onCopy = () => {
472
- if (isCopied)
473
- return;
472
+ if (isCopied) return;
474
473
  copyToClipboard(value);
475
474
  };
476
475
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "copilotKitCodeBlock", children: [
@@ -890,8 +889,8 @@ var Messages = ({ messages, inProgress, children }) => {
890
889
  } else if (message instanceof import_runtime_client_gql.TextMessage && message.role == "assistant") {
891
890
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: isCurrentMessage && inProgress && !message.content ? context.icons.spinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Markdown, { content: message.content }) }, index);
892
891
  } else if (message instanceof import_runtime_client_gql.ActionExecutionMessage) {
893
- if (chatComponentsCache.current !== null && chatComponentsCache.current.actions[message.name]) {
894
- const render = chatComponentsCache.current.actions[message.name];
892
+ if (chatComponentsCache.current !== null && chatComponentsCache.current[message.name]) {
893
+ const render = chatComponentsCache.current[message.name];
895
894
  if (typeof render === "string") {
896
895
  if (isCurrentMessage && inProgress) {
897
896
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
@@ -933,50 +932,6 @@ var Messages = ({ messages, inProgress, children }) => {
933
932
  } else {
934
933
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: context.icons.spinnerIcon }, index);
935
934
  }
936
- } else if (message instanceof import_runtime_client_gql.AgentStateMessage) {
937
- let render;
938
- if (chatComponentsCache.current !== null) {
939
- render = chatComponentsCache.current.coagentActions[`${message.agentName}-${message.nodeName}`] || chatComponentsCache.current.coagentActions[`${message.agentName}-global`];
940
- }
941
- if (render) {
942
- if (typeof render === "string") {
943
- if (isCurrentMessage && inProgress) {
944
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
945
- context.icons.spinnerIcon,
946
- " ",
947
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "inProgressLabel", children: render })
948
- ] }, index);
949
- } else {
950
- return null;
951
- }
952
- } else {
953
- const state = message.state;
954
- let status = message.active ? "inProgress" : "complete";
955
- const toRender = render({
956
- status,
957
- state,
958
- nodeName: message.nodeName
959
- });
960
- if (!toRender && status === "complete") {
961
- return null;
962
- }
963
- if (typeof toRender === "string") {
964
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
965
- isCurrentMessage && inProgress && context.icons.spinnerIcon,
966
- " ",
967
- toRender
968
- ] }, index);
969
- } else {
970
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "copilotKitCustomAssistantMessage", children: toRender }, index);
971
- }
972
- }
973
- } else if (!inProgress || !isCurrentMessage) {
974
- return null;
975
- } else {
976
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: context.icons.spinnerIcon }, index);
977
- }
978
- } else if (message instanceof import_runtime_client_gql.ResultMessage && inProgress && isCurrentMessage) {
979
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: context.icons.spinnerIcon }, index);
980
935
  }
981
936
  }),
982
937
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("footer", { ref: messagesEndRef, children })
@@ -1164,15 +1119,13 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
1164
1119
  const textareaRef = (0, import_react7.useRef)(null);
1165
1120
  const handleDivClick = (event) => {
1166
1121
  var _a;
1167
- if (event.target !== event.currentTarget)
1168
- return;
1122
+ if (event.target !== event.currentTarget) return;
1169
1123
  (_a = textareaRef.current) == null ? void 0 : _a.focus();
1170
1124
  };
1171
1125
  const [text, setText] = (0, import_react7.useState)("");
1172
1126
  const send = () => {
1173
1127
  var _a;
1174
- if (inProgress)
1175
- return;
1128
+ if (inProgress) return;
1176
1129
  onSend(text);
1177
1130
  setText("");
1178
1131
  (_a = textareaRef.current) == null ? void 0 : _a.focus();
@@ -1327,13 +1280,11 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
1327
1280
  // src/components/chat/Chat.tsx
1328
1281
  var import_react10 = __toESM(require("react"));
1329
1282
  var import_react_core7 = require("@copilotkit/react-core");
1330
- var import_runtime_client_gql6 = require("@copilotkit/runtime-client-gql");
1283
+ var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
1331
1284
  var import_shared3 = require("@copilotkit/shared");
1332
1285
 
1333
1286
  // src/components/dev-console/utils.ts
1334
1287
  var import_react_core5 = require("@copilotkit/react-core");
1335
- var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
1336
- var import_runtime_client_gql5 = require("@copilotkit/runtime-client-gql");
1337
1288
  function shouldShowDevConsole(showDevConsole) {
1338
1289
  if (typeof showDevConsole === "boolean") {
1339
1290
  return showDevConsole;
@@ -1394,7 +1345,6 @@ function getPublishedCopilotKitVersion(current, forceCheck = false) {
1394
1345
  });
1395
1346
  }
1396
1347
  function logReadables(context) {
1397
- console.log("%cCurrent Readables:", "font-size: 16px; font-weight: bold;");
1398
1348
  const readables = context.getContextString([], import_react_core5.defaultCopilotContextCategories).trim();
1399
1349
  if (readables.length === 0) {
1400
1350
  console.log("No readables found");
@@ -1403,7 +1353,6 @@ function logReadables(context) {
1403
1353
  console.log(readables);
1404
1354
  }
1405
1355
  function logActions(context) {
1406
- console.log("%cCurrent Actions:", "font-size: 16px; font-weight: bold;");
1407
1356
  if (Object.values(context.actions).length === 0) {
1408
1357
  console.log("No actions found");
1409
1358
  return;
@@ -1416,53 +1365,6 @@ function logActions(context) {
1416
1365
  console.groupEnd();
1417
1366
  }
1418
1367
  }
1419
- function logMessages(context) {
1420
- console.log("%cCurrent Messages:", "font-size: 16px; font-weight: bold;");
1421
- if (context.messages.length === 0) {
1422
- console.log("No messages found");
1423
- return;
1424
- }
1425
- const tableData = context.messages.map((message) => {
1426
- if (message instanceof import_runtime_client_gql4.TextMessage) {
1427
- return {
1428
- id: message.id,
1429
- type: "TextMessage",
1430
- role: message.role,
1431
- name: void 0,
1432
- scope: void 0,
1433
- content: message.content
1434
- };
1435
- } else if (message instanceof import_runtime_client_gql4.ActionExecutionMessage) {
1436
- return {
1437
- id: message.id,
1438
- type: "ActionExecutionMessage",
1439
- role: void 0,
1440
- name: message.name,
1441
- scope: message.scope,
1442
- content: message.arguments
1443
- };
1444
- } else if (message instanceof import_runtime_client_gql4.ResultMessage) {
1445
- return {
1446
- id: message.id,
1447
- type: "ResultMessage",
1448
- role: void 0,
1449
- name: message.actionName,
1450
- scope: message.actionExecutionId,
1451
- content: message.result
1452
- };
1453
- } else if (message instanceof import_runtime_client_gql5.AgentStateMessage) {
1454
- return {
1455
- id: message.id,
1456
- type: `AgentStateMessage (running: ${message.running})`,
1457
- role: message.role,
1458
- name: void 0,
1459
- scope: message.threadId,
1460
- content: message.state
1461
- };
1462
- }
1463
- });
1464
- console.table(tableData);
1465
- }
1466
1368
 
1467
1369
  // src/components/dev-console/console.tsx
1468
1370
  var import_react_core6 = require("@copilotkit/react-core");
@@ -1737,7 +1639,6 @@ function DebugMenuButton({
1737
1639
  children: [
1738
1640
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react9.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logReadables(context), children: "Log Readables" }) }),
1739
1641
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react9.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logActions(context), children: "Log Actions" }) }),
1740
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react9.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logMessages(context), children: "Log Messages" }) }),
1741
1642
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react9.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => checkForUpdates(true), children: "Check for Updates" }) }),
1742
1643
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("hr", {}),
1743
1644
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react9.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => setShowDevConsole(false), children: "Hide Dev Console" }) })
@@ -1856,9 +1757,9 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
1856
1757
  const sendMessage = (messageContent) => __async(void 0, null, function* () {
1857
1758
  abortSuggestions();
1858
1759
  setCurrentSuggestions([]);
1859
- const message = new import_runtime_client_gql6.TextMessage({
1760
+ const message = new import_runtime_client_gql4.TextMessage({
1860
1761
  content: messageContent,
1861
- role: import_runtime_client_gql6.Role.User
1762
+ role: import_runtime_client_gql4.Role.User
1862
1763
  });
1863
1764
  appendMessage(message);
1864
1765
  if (onSubmitMessage) {