@copilotkit/react-ui 1.1.2 → 1.1.3-feat-runtime-remote-actions.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 (117) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +32 -37
  3. package/dist/{chunk-UJHTRHS4.mjs → chunk-36OL6SEM.mjs} +3 -2
  4. package/dist/chunk-36OL6SEM.mjs.map +1 -0
  5. package/dist/{chunk-EJ4SJ2HU.mjs → chunk-AFD5I7MW.mjs} +2 -2
  6. package/dist/chunk-AFD5I7MW.mjs.map +1 -0
  7. package/dist/{chunk-WOPUCUQK.mjs → chunk-C534T3DM.mjs} +10 -11
  8. package/dist/{chunk-WOPUCUQK.mjs.map → chunk-C534T3DM.mjs.map} +1 -1
  9. package/dist/{chunk-SE6DAYSX.mjs → chunk-FLV3J3VX.mjs} +5 -5
  10. package/dist/chunk-FLV3J3VX.mjs.map +1 -0
  11. package/dist/{chunk-LLOSOTAT.mjs → chunk-FO7Z5LAL.mjs} +6 -3
  12. package/dist/chunk-FO7Z5LAL.mjs.map +1 -0
  13. package/dist/{chunk-4Z2WDXSK.mjs → chunk-FOZVHL73.mjs} +49 -4
  14. package/dist/chunk-FOZVHL73.mjs.map +1 -0
  15. package/dist/{chunk-PF5HUDUP.mjs → chunk-H7TM5JE6.mjs} +54 -2
  16. package/dist/chunk-H7TM5JE6.mjs.map +1 -0
  17. package/dist/{chunk-SWWFXRFF.mjs → chunk-HR36Y2FQ.mjs} +4 -4
  18. package/dist/chunk-HR36Y2FQ.mjs.map +1 -0
  19. package/dist/{chunk-D6QNFZXK.mjs → chunk-I4QG2ZZU.mjs} +4 -2
  20. package/dist/chunk-I4QG2ZZU.mjs.map +1 -0
  21. package/dist/{chunk-KSCXPA74.mjs → chunk-WCPLXRZX.mjs} +1 -1
  22. package/dist/chunk-WCPLXRZX.mjs.map +1 -0
  23. package/dist/{chunk-UC3Y7MWX.mjs → chunk-YOH25I6N.mjs} +5 -5
  24. package/dist/chunk-YOH25I6N.mjs.map +1 -0
  25. package/dist/components/chat/Button.d.ts +2 -1
  26. package/dist/components/chat/Button.js +4 -4
  27. package/dist/components/chat/Button.js.map +1 -1
  28. package/dist/components/chat/Button.mjs +1 -1
  29. package/dist/components/chat/Chat.d.ts +4 -49
  30. package/dist/components/chat/Chat.js +101 -5
  31. package/dist/components/chat/Chat.js.map +1 -1
  32. package/dist/components/chat/Chat.mjs +5 -5
  33. package/dist/components/chat/ChatContext.d.ts +2 -1
  34. package/dist/components/chat/Header.d.ts +2 -1
  35. package/dist/components/chat/Header.js +4 -4
  36. package/dist/components/chat/Header.js.map +1 -1
  37. package/dist/components/chat/Header.mjs +1 -1
  38. package/dist/components/chat/Icons.d.ts +14 -13
  39. package/dist/components/chat/Input.d.ts +2 -1
  40. package/dist/components/chat/Markdown.d.ts +3 -1
  41. package/dist/components/chat/Messages.d.ts +2 -1
  42. package/dist/components/chat/Messages.js +46 -2
  43. package/dist/components/chat/Messages.js.map +1 -1
  44. package/dist/components/chat/Messages.mjs +1 -1
  45. package/dist/components/chat/Modal.d.ts +2 -1
  46. package/dist/components/chat/Modal.js +114 -20
  47. package/dist/components/chat/Modal.js.map +1 -1
  48. package/dist/components/chat/Modal.mjs +9 -9
  49. package/dist/components/chat/Popup.d.ts +2 -48
  50. package/dist/components/chat/Popup.js +114 -20
  51. package/dist/components/chat/Popup.js.map +1 -1
  52. package/dist/components/chat/Popup.mjs +10 -10
  53. package/dist/components/chat/Response.d.ts +2 -1
  54. package/dist/components/chat/Sidebar.d.ts +2 -1
  55. package/dist/components/chat/Sidebar.js +115 -20
  56. package/dist/components/chat/Sidebar.js.map +1 -1
  57. package/dist/components/chat/Sidebar.mjs +10 -10
  58. package/dist/components/chat/Suggestion.d.ts +2 -1
  59. package/dist/components/chat/Suggestion.js.map +1 -1
  60. package/dist/components/chat/Suggestion.mjs +1 -1
  61. package/dist/components/chat/Window.d.ts +2 -1
  62. package/dist/components/chat/Window.js +23 -8
  63. package/dist/components/chat/Window.js.map +1 -1
  64. package/dist/components/chat/Window.mjs +3 -1
  65. package/dist/components/chat/index.d.ts +1 -0
  66. package/dist/components/chat/index.js +115 -20
  67. package/dist/components/chat/index.js.map +1 -1
  68. package/dist/components/chat/index.mjs +11 -11
  69. package/dist/components/chat/props.d.ts +0 -6
  70. package/dist/components/chat/props.js.map +1 -1
  71. package/dist/components/dev-console/console.d.ts +4 -2
  72. package/dist/components/dev-console/console.js +52 -0
  73. package/dist/components/dev-console/console.js.map +1 -1
  74. package/dist/components/dev-console/console.mjs +2 -2
  75. package/dist/components/dev-console/icons.d.ts +7 -5
  76. package/dist/components/dev-console/index.d.ts +1 -0
  77. package/dist/components/dev-console/index.js +52 -0
  78. package/dist/components/dev-console/index.js.map +1 -1
  79. package/dist/components/dev-console/index.mjs +2 -2
  80. package/dist/components/dev-console/utils.d.ts +2 -1
  81. package/dist/components/dev-console/utils.js +53 -0
  82. package/dist/components/dev-console/utils.js.map +1 -1
  83. package/dist/components/dev-console/utils.mjs +3 -1
  84. package/dist/components/index.d.ts +1 -0
  85. package/dist/components/index.js +115 -20
  86. package/dist/components/index.js.map +1 -1
  87. package/dist/components/index.mjs +11 -11
  88. package/dist/index.css +5 -4
  89. package/dist/index.css.map +1 -1
  90. package/dist/index.d.ts +1 -0
  91. package/dist/index.js +115 -20
  92. package/dist/index.js.map +1 -1
  93. package/dist/index.mjs +11 -11
  94. package/package.json +8 -8
  95. package/src/components/chat/Button.tsx +4 -8
  96. package/src/components/chat/Chat.tsx +2 -1
  97. package/src/components/chat/Header.tsx +4 -4
  98. package/src/components/chat/Messages.tsx +83 -2
  99. package/src/components/chat/Modal.tsx +4 -5
  100. package/src/components/chat/Popup.tsx +1 -0
  101. package/src/components/chat/Sidebar.tsx +2 -0
  102. package/src/components/chat/Suggestion.tsx +2 -0
  103. package/src/components/chat/Window.tsx +3 -2
  104. package/src/components/chat/props.ts +2 -10
  105. package/src/components/dev-console/console.tsx +6 -0
  106. package/src/components/dev-console/utils.ts +56 -0
  107. package/src/css/markdown.css +5 -5
  108. package/dist/chunk-4Z2WDXSK.mjs.map +0 -1
  109. package/dist/chunk-D6QNFZXK.mjs.map +0 -1
  110. package/dist/chunk-EJ4SJ2HU.mjs.map +0 -1
  111. package/dist/chunk-KSCXPA74.mjs.map +0 -1
  112. package/dist/chunk-LLOSOTAT.mjs.map +0 -1
  113. package/dist/chunk-PF5HUDUP.mjs.map +0 -1
  114. package/dist/chunk-SE6DAYSX.mjs.map +0 -1
  115. package/dist/chunk-SWWFXRFF.mjs.map +0 -1
  116. package/dist/chunk-UC3Y7MWX.mjs.map +0 -1
  117. package/dist/chunk-UJHTRHS4.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # ui
2
2
 
3
+ ## 1.1.3-feat-runtime-remote-actions.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Reduce request size by skipping intermediate state
8
+ - Updated dependencies
9
+ - @copilotkit/runtime-client-gql@1.1.3-feat-runtime-remote-actions.1
10
+ - @copilotkit/react-core@1.1.3-feat-runtime-remote-actions.1
11
+ - @copilotkit/shared@1.1.3-feat-runtime-remote-actions.1
12
+
13
+ ## 1.1.3-feat-runtime-remote-actions.0
14
+
15
+ ### Patch Changes
16
+
17
+ - 638d51d: appendMessage fix 1
18
+ - Rename hooks and bugfixes
19
+ - faccbe1: state-abuse resistance for useCopilotChat
20
+ - b0cf700: remove unnecessary logging
21
+ - Updated dependencies [638d51d]
22
+ - Updated dependencies
23
+ - Updated dependencies [faccbe1]
24
+ - Updated dependencies [b0cf700]
25
+ - @copilotkit/react-core@1.1.3-feat-runtime-remote-actions.0
26
+ - @copilotkit/runtime-client-gql@1.1.3-feat-runtime-remote-actions.0
27
+ - @copilotkit/shared@1.1.3-feat-runtime-remote-actions.0
28
+
3
29
  ## 1.1.2
4
30
 
5
31
  ### Patch Changes
package/README.md CHANGED
@@ -1,50 +1,45 @@
1
1
  <div align="center">
2
- <picture>
3
- <source media="(prefers-color-scheme: dark)" srcset="https://github.com/CopilotKit/CopilotKit/assets/746397/5890217b-524e-49c5-a89e-b8743d2acd51">
4
- <img alt="CopilotKit Logo" src="https://github.com/CopilotKit/CopilotKit/assets/746397/bd5c9079-929b-4d55-bdc9-16d1c8181b71" width="450px" max-width="100%"/>
5
- </picture>
6
- </a>
7
- </div>
8
-
9
- <p align="center">
10
- <a href="https://discord.gg/6dffbvGU3D">
11
- <img src="https://dcbadge.vercel.app/api/server/6dffbvGU3D?compact=true&style=flat" alt="Discord">
12
- </a>
13
- <a href="https://github.com/CopilotKit/CopilotKit/actions/workflows/ci.yml">
14
- <img src="https://github.com/CopilotKit/CopilotKit/actions/workflows/ci.yml/badge.svg" alt="GitHub CI">
2
+ <a href="https://copilotkit.ai" target="_blank">
3
+ <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/banner.png" alt="CopilotKit Logo">
15
4
  </a>
16
5
 
17
- <a href="https://www.npmjs.com/package/@copilotkit/react-core">
18
- <img src="https://img.shields.io/npm/v/@copilotkit/react-core" alt="NPM">
19
- <img src="https://img.shields.io/github/license/CopilotKit/CopilotKit" alt="MIT">
20
-
21
- </p>
6
+ <br/>
22
7
 
23
- <h1 align="center">
24
- The Open-Source Copilot Framework
25
- </h1>
8
+ <strong>
9
+ CopilotKit is the open-source framework for integrating powerful AI Copilots into any application. Easily implement custom AI Chatbots, AI Agents, AI Textareas, and more.
10
+ </strong>
11
+ </div>
26
12
 
27
- <h2 align="center">
28
- Build, deploy, and operate fully custom AI Copilots.
29
- </h2>
13
+ <br/>
30
14
 
31
- <h3 align="center">
32
- in-app AI chatbots, AI agents, and AI Textareas.
33
- </h3>
15
+ <div align="center">
16
+ <a href="https://www.npmjs.com/package/@copilotkit/react-core" target="_blank">
17
+ <img src="https://img.shields.io/npm/v/%40copilotkit%2Freact-core?logo=npm&logoColor=%23FFFFFF&label=Version&color=%236963ff" alt="NPM">
18
+ </a>
19
+ <img src="https://img.shields.io/github/license/copilotkit/copilotkit?color=%236963ff&label=License" alt="MIT">
20
+ <a href="https://discord.gg/6dffbvGU3D" target="_blank">
21
+ <img src="https://img.shields.io/discord/1122926057641742418?logo=discord&logoColor=%23FFFFFF&label=Discord&color=%236963ff" alt="Discord">
22
+ </a>
23
+ </div>
24
+ <br/>
34
25
 
35
- <p align="center">
36
- <a href="https://discord.com/invite/6dffbvGU3D">
37
- <img src="https://github.com/CopilotKit/CopilotKit/assets/131273140/bf8d96ea-3aeb-4c9a-9043-96a868b7ad0f" alt="Join our Discord" height="30">
26
+ <div align="center">
27
+ <a href="https://discord.gg/6dffbvGU3D?ref=github_readme" target="_blank">
28
+ <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/btn_discord.png" alt="CopilotKit Discord" height="40px">
38
29
  </a>
39
- &nbsp;&middot;&nbsp;
40
- <a href="https://docs.copilotkit.ai/getting-started/quickstart-chatbot">
41
- <img src="https://github.com/CopilotKit/CopilotKit/assets/131273140/a4a0fd04-6aee-4e02-9c3e-3f11d60b4e8b" alt="Read the Docs" height="30">
30
+ <a href="https://docs.copilotkit.ai?ref=github_readme" target="_blank">
31
+ <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/btn_docs.png" alt="CopilotKit GitHub" height="40px">
42
32
  </a>
43
- &nbsp;&middot;&nbsp;
44
- <a href="https://cloud.copilotkit.ai">
45
- <img src="https://github.com/CopilotKit/CopilotKit/assets/131273140/28ca62a8-cf93-4d3f-96b0-dc11bf89b734" alt="Try Copilot Cloud" height="30">
33
+ <a href="https://cloud.copilotkit.ai?ref=github_readme" target="_blank">
34
+ <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/btn_cloud.png" alt="CopilotKit GitHub" height="40px">
46
35
  </a>
47
- </p>
36
+ </div>
37
+
38
+ <br />
39
+
40
+ <div align="center">
41
+ <img src="https://github.com/CopilotKit/CopilotKit/raw/main/assets/animated-banner.gif" alt="CopilotKit Screenshot" style="border-radius: 15px;" />
42
+ </div>
48
43
 
49
44
  # Documentation
50
45
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-WOPUCUQK.mjs";
3
+ } from "./chunk-C534T3DM.mjs";
4
4
  import {
5
5
  __spreadProps,
6
6
  __spreadValues
@@ -18,6 +18,7 @@ function CopilotSidebar(props) {
18
18
  );
19
19
  const onSetOpen = (open) => {
20
20
  var _a;
21
+ console.log("onSetOpen", open);
21
22
  (_a = props.onSetOpen) == null ? void 0 : _a.call(props, open);
22
23
  setExpandedClassName(open ? "sidebarExpanded" : "");
23
24
  };
@@ -27,4 +28,4 @@ function CopilotSidebar(props) {
27
28
  export {
28
29
  CopilotSidebar
29
30
  };
30
- //# sourceMappingURL=chunk-UJHTRHS4.mjs.map
31
+ //# sourceMappingURL=chunk-36OL6SEM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Sidebar.tsx"],"sourcesContent":["/**\n * <br/>\n * <img src=\"/images/CopilotSidebar.gif\" width=\"500\" />\n *\n * A chatbot sidebar component for the CopilotKit framework. Highly customizable through various props and custom CSS.\n *\n * See [CopilotPopup](/reference/components/CopilotPopup) for a popup version of this component.\n *\n * ## Install Dependencies\n *\n * This component is part of the [@copilotkit/react-ui](https://npmjs.com/package/@copilotkit/react-ui) package.\n *\n * ```shell npm2yarn \\\"@copilotkit/react-ui\"\\\n * npm install @copilotkit/react-core @copilotkit/react-ui\n * ```\n *\n * ## Usage\n *\n * ```tsx\n * import { CopilotSidebar } from \"@copilotkit/react-ui\";\n * import \"@copilotkit/react-ui/styles.css\";\n *\n * <CopilotSidebar\n * labels={{\n * title: \"Your Assistant\",\n * initial: \"Hi! 👋 How can I assist you today?\",\n * }}\n * >\n * <YourApp/>\n * </CopilotSidebar>\n * ```\n *\n * ### Look & Feel\n *\n * By default, CopilotKit components do not have any styles. You can import CopilotKit's stylesheet at the root of your project:\n * ```tsx fileName=\"YourRootComponent.tsx\" {2}\n * ...\n * import \"@copilotkit/react-ui/styles.css\";\n *\n * export function YourRootComponent() {\n * return (\n * <CopilotKit>\n * ...\n * </CopilotKit>\n * );\n * }\n * ```\n * For more information about how to customize the styles, check out the [Customize Look & Feel](/concepts/customize-look-and-feel) guide.\n */\nimport React, { useState } from \"react\";\nimport { CopilotModal, CopilotModalProps } from \"./Modal\";\n\nexport function CopilotSidebar(props: CopilotModalProps) {\n props = {\n ...props,\n className: props.className ? props.className + \" copilotKitSidebar\" : \"copilotKitSidebar\",\n };\n const [expandedClassName, setExpandedClassName] = useState(\n props.defaultOpen ? \"sidebarExpanded\" : \"\",\n );\n\n const onSetOpen = (open: boolean) => {\n console.log(\"onSetOpen\", open);\n props.onSetOpen?.(open);\n setExpandedClassName(open ? \"sidebarExpanded\" : \"\");\n };\n\n return (\n <div className={`copilotKitSidebarContentWrapper ${expandedClassName}`}>\n <CopilotModal {...props} {...{ onSetOpen }}>\n {props.children}\n </CopilotModal>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAiDA,SAAgB,gBAAgB;AAoB1B;AAjBC,SAAS,eAAe,OAA0B;AACvD,UAAQ,iCACH,QADG;AAAA,IAEN,WAAW,MAAM,YAAY,MAAM,YAAY,uBAAuB;AAAA,EACxE;AACA,QAAM,CAAC,mBAAmB,oBAAoB,IAAI;AAAA,IAChD,MAAM,cAAc,oBAAoB;AAAA,EAC1C;AAEA,QAAM,YAAY,CAAC,SAAkB;AA7DvC;AA8DI,YAAQ,IAAI,aAAa,IAAI;AAC7B,gBAAM,cAAN,+BAAkB;AAClB,yBAAqB,OAAO,oBAAoB,EAAE;AAAA,EACpD;AAEA,SACE,oBAAC,SAAI,WAAW,mCAAmC,qBACjD,8BAAC,8DAAiB,QAAW,EAAE,UAAU,IAAxC,EACE,gBAAM,WACT,GACF;AAEJ;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-WOPUCUQK.mjs";
3
+ } from "./chunk-C534T3DM.mjs";
4
4
  import {
5
5
  __spreadProps,
6
6
  __spreadValues
@@ -18,4 +18,4 @@ function CopilotPopup(props) {
18
18
  export {
19
19
  CopilotPopup
20
20
  };
21
- //# sourceMappingURL=chunk-EJ4SJ2HU.mjs.map
21
+ //# sourceMappingURL=chunk-AFD5I7MW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Popup.tsx"],"sourcesContent":["/**\n * <br/>\n * <img src=\"/images/CopilotPopup.gif\" width=\"500\" />\n *\n * A chatbot popup component for the CopilotKit framework. The component allows for a high degree\n * of customization through various props and custom CSS.\n *\n * See [CopilotSidebar](/reference/components/CopilotSidebar) for a sidebar version of this component.\n *\n * ## Install Dependencies\n *\n * This component is part of the [@copilotkit/react-ui](https://npmjs.com/package/@copilotkit/react-ui) package.\n *\n * ```shell npm2yarn \\\"@copilotkit/react-ui\"\\\n * npm install @copilotkit/react-core @copilotkit/react-ui\n * ```\n * ## Usage\n *\n * ```tsx\n * import { CopilotPopup } from \"@copilotkit/react-ui\";\n * import \"@copilotkit/react-ui/styles.css\";\n *\n * <CopilotPopup\n * labels={{\n * title: \"Your Assistant\",\n * initial: \"Hi! 👋 How can I assist you today?\",\n * }}\n * />\n * ```\n *\n * ### Look & Feel\n *\n * By default, CopilotKit components do not have any styles. You can import CopilotKit's stylesheet at the root of your project:\n * ```tsx fileName=\"YourRootComponent.tsx\" {2}\n * ...\n * import \"@copilotkit/react-ui/styles.css\";\n *\n * export function YourRootComponent() {\n * return (\n * <CopilotKit>\n * ...\n * </CopilotKit>\n * );\n * }\n * ```\n * For more information about how to customize the styles, check out the [Customize Look & Feel](/concepts/customize-look-and-feel) guide.\n */\n\nimport { CopilotModal, CopilotModalProps } from \"./Modal\";\n\nexport function CopilotPopup(props: CopilotModalProps) {\n props = {\n ...props,\n className: props.className ? props.className + \" copilotKitPopup\" : \"copilotKitPopup\",\n };\n return <CopilotModal {...props}>{props.children}</CopilotModal>;\n}\n"],"mappings":";;;;;;;;;AAuDS;AALF,SAAS,aAAa,OAA0B;AACrD,UAAQ,iCACH,QADG;AAAA,IAEN,WAAW,MAAM,YAAY,MAAM,YAAY,qBAAqB;AAAA,EACtE;AACA,SAAO,oBAAC,+CAAiB,QAAjB,EAAyB,gBAAM,WAAS;AAClD;","names":[]}
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  Window
3
- } from "./chunk-LLOSOTAT.mjs";
3
+ } from "./chunk-FO7Z5LAL.mjs";
4
4
  import {
5
5
  Header
6
- } from "./chunk-SE6DAYSX.mjs";
6
+ } from "./chunk-FLV3J3VX.mjs";
7
7
  import {
8
8
  Button
9
- } from "./chunk-UC3Y7MWX.mjs";
9
+ } from "./chunk-YOH25I6N.mjs";
10
10
  import {
11
11
  CopilotChat
12
- } from "./chunk-SWWFXRFF.mjs";
12
+ } from "./chunk-HR36Y2FQ.mjs";
13
13
  import {
14
14
  Input
15
15
  } from "./chunk-U6J5DGOE.mjs";
16
16
  import {
17
17
  Messages
18
- } from "./chunk-4Z2WDXSK.mjs";
18
+ } from "./chunk-FOZVHL73.mjs";
19
19
  import {
20
20
  ResponseButton
21
21
  } from "./chunk-XSUSSWDS.mjs";
@@ -50,23 +50,22 @@ var CopilotModal = ({
50
50
  }) => {
51
51
  const [openState, setOpenState] = React.useState(defaultOpen);
52
52
  const setOpen = (open) => {
53
+ console.log("setOpen!!", open);
53
54
  onSetOpen == null ? void 0 : onSetOpen(open);
54
55
  setOpenState(open);
55
56
  };
56
- return /* @__PURE__ */ jsxs(ChatContextProvider, { icons, labels, open: openState, setOpen: setOpenState, children: [
57
+ return /* @__PURE__ */ jsxs(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
57
58
  children,
58
59
  /* @__PURE__ */ jsxs("div", { className, children: [
59
- /* @__PURE__ */ jsx(Button2, { open: openState, setOpen }),
60
+ /* @__PURE__ */ jsx(Button2, {}),
60
61
  /* @__PURE__ */ jsxs(
61
62
  Window2,
62
63
  {
63
- open: openState,
64
- setOpen,
65
64
  clickOutsideToClose,
66
65
  shortcut,
67
66
  hitEscapeToClose,
68
67
  children: [
69
- /* @__PURE__ */ jsx(Header2, { open: openState, setOpen }),
68
+ /* @__PURE__ */ jsx(Header2, {}),
70
69
  /* @__PURE__ */ jsx(
71
70
  CopilotChat,
72
71
  {
@@ -90,4 +89,4 @@ var CopilotModal = ({
90
89
  export {
91
90
  CopilotModal
92
91
  };
93
- //# sourceMappingURL=chunk-WOPUCUQK.mjs.map
92
+ //# sourceMappingURL=chunk-C534T3DM.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/chat/Modal.tsx"],"sourcesContent":["import React from \"react\";\nimport { ChatContextProvider } from \"./ChatContext\";\nimport { ButtonProps, HeaderProps, WindowProps } from \"./props\";\nimport { Window as DefaultWindow } from \"./Window\";\nimport { Button as DefaultButton } from \"./Button\";\nimport { Header as DefaultHeader } from \"./Header\";\nimport { Messages as DefaultMessages } from \"./Messages\";\nimport { Input as DefaultInput } from \"./Input\";\nimport { ResponseButton as DefaultResponseButton } from \"./Response\";\nimport { CopilotChat, CopilotChatProps } from \"./Chat\";\n\nexport interface CopilotModalProps extends CopilotChatProps {\n /**\n * Whether the chat window should be open by default.\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * If the chat window should close when the user clicks outside of it.\n * @default true\n */\n clickOutsideToClose?: boolean;\n\n /**\n * If the chat window should close when the user hits the Escape key.\n * @default true\n */\n hitEscapeToClose?: boolean;\n\n /**\n * The shortcut key to open the chat window.\n * Uses Command-[shortcut] on a Mac and Ctrl-[shortcut] on Windows.\n * @default '/'\n */\n shortcut?: string;\n\n /**\n * A callback that gets called when the chat window opens or closes.\n */\n onSetOpen?: (open: boolean) => void;\n\n /**\n * A custom Window component to use instead of the default.\n */\n Window?: React.ComponentType<WindowProps>;\n\n /**\n * A custom Button component to use instead of the default.\n */\n Button?: React.ComponentType<ButtonProps>;\n\n /**\n * A custom Header component to use instead of the default.\n */\n Header?: React.ComponentType<HeaderProps>;\n}\n\nexport const CopilotModal = ({\n instructions,\n defaultOpen = false,\n clickOutsideToClose = true,\n hitEscapeToClose = true,\n onSetOpen,\n onSubmitMessage,\n shortcut = \"/\",\n icons,\n labels,\n makeSystemMessage,\n showResponseButton = true,\n onInProgress,\n Window = DefaultWindow,\n Button = DefaultButton,\n Header = DefaultHeader,\n Messages = DefaultMessages,\n Input = DefaultInput,\n ResponseButton = DefaultResponseButton,\n className,\n children,\n}: CopilotModalProps) => {\n const [openState, setOpenState] = React.useState(defaultOpen);\n\n const setOpen = (open: boolean) => {\n onSetOpen?.(open);\n setOpenState(open);\n };\n\n return (\n <ChatContextProvider icons={icons} labels={labels} open={openState} setOpen={setOpenState}>\n {children}\n <div className={className}>\n <Button open={openState} setOpen={setOpen}></Button>\n <Window\n open={openState}\n setOpen={setOpen}\n clickOutsideToClose={clickOutsideToClose}\n shortcut={shortcut}\n hitEscapeToClose={hitEscapeToClose}\n >\n <Header open={openState} setOpen={setOpen} />\n <CopilotChat\n instructions={instructions}\n onSubmitMessage={onSubmitMessage}\n makeSystemMessage={makeSystemMessage}\n showResponseButton={showResponseButton}\n onInProgress={onInProgress}\n Messages={Messages}\n Input={Input}\n ResponseButton={ResponseButton}\n />\n </Window>\n </div>\n </ChatContextProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AA2FV,cACA,YADA;AAjCD,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA,cAAc;AAAA,EACd,sBAAsB;AAAA,EACtB,mBAAmB;AAAA,EACnB;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAqB;AAAA,EACrB;AAAA,EACA,QAAAA,UAAS;AAAA,EACT,QAAAC,UAAS;AAAA,EACT,QAAAC,UAAS;AAAA,EACT,UAAAC,YAAW;AAAA,EACX,OAAAC,SAAQ;AAAA,EACR,gBAAAC,kBAAiB;AAAA,EACjB;AAAA,EACA;AACF,MAAyB;AACvB,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,WAAW;AAE5D,QAAM,UAAU,CAAC,SAAkB;AACjC,2CAAY;AACZ,iBAAa,IAAI;AAAA,EACnB;AAEA,SACE,qBAAC,uBAAoB,OAAc,QAAgB,MAAM,WAAW,SAAS,cAC1E;AAAA;AAAA,IACD,qBAAC,SAAI,WACH;AAAA,0BAACJ,SAAA,EAAO,MAAM,WAAW,SAAkB;AAAA,MAC3C;AAAA,QAACD;AAAA,QAAA;AAAA,UACC,MAAM;AAAA,UACN;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UAEA;AAAA,gCAACE,SAAA,EAAO,MAAM,WAAW,SAAkB;AAAA,YAC3C;AAAA,cAAC;AAAA;AAAA,gBACC;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA,UAAUC;AAAA,gBACV,OAAOC;AAAA,gBACP,gBAAgBC;AAAA;AAAA,YAClB;AAAA;AAAA;AAAA,MACF;AAAA,OACF;AAAA,KACF;AAEJ;","names":["Window","Button","Header","Messages","Input","ResponseButton"]}
1
+ {"version":3,"sources":["../src/components/chat/Modal.tsx"],"sourcesContent":["import React from \"react\";\nimport { ChatContextProvider } from \"./ChatContext\";\nimport { ButtonProps, HeaderProps, WindowProps } from \"./props\";\nimport { Window as DefaultWindow } from \"./Window\";\nimport { Button as DefaultButton } from \"./Button\";\nimport { Header as DefaultHeader } from \"./Header\";\nimport { Messages as DefaultMessages } from \"./Messages\";\nimport { Input as DefaultInput } from \"./Input\";\nimport { ResponseButton as DefaultResponseButton } from \"./Response\";\nimport { CopilotChat, CopilotChatProps } from \"./Chat\";\n\nexport interface CopilotModalProps extends CopilotChatProps {\n /**\n * Whether the chat window should be open by default.\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * If the chat window should close when the user clicks outside of it.\n * @default true\n */\n clickOutsideToClose?: boolean;\n\n /**\n * If the chat window should close when the user hits the Escape key.\n * @default true\n */\n hitEscapeToClose?: boolean;\n\n /**\n * The shortcut key to open the chat window.\n * Uses Command-[shortcut] on a Mac and Ctrl-[shortcut] on Windows.\n * @default '/'\n */\n shortcut?: string;\n\n /**\n * A callback that gets called when the chat window opens or closes.\n */\n onSetOpen?: (open: boolean) => void;\n\n /**\n * A custom Window component to use instead of the default.\n */\n Window?: React.ComponentType<WindowProps>;\n\n /**\n * A custom Button component to use instead of the default.\n */\n Button?: React.ComponentType<ButtonProps>;\n\n /**\n * A custom Header component to use instead of the default.\n */\n Header?: React.ComponentType<HeaderProps>;\n}\n\nexport const CopilotModal = ({\n instructions,\n defaultOpen = false,\n clickOutsideToClose = true,\n hitEscapeToClose = true,\n onSetOpen,\n onSubmitMessage,\n shortcut = \"/\",\n icons,\n labels,\n makeSystemMessage,\n showResponseButton = true,\n onInProgress,\n Window = DefaultWindow,\n Button = DefaultButton,\n Header = DefaultHeader,\n Messages = DefaultMessages,\n Input = DefaultInput,\n ResponseButton = DefaultResponseButton,\n className,\n children,\n}: CopilotModalProps) => {\n const [openState, setOpenState] = React.useState(defaultOpen);\n\n const setOpen = (open: boolean) => {\n console.log(\"setOpen!!\", open);\n onSetOpen?.(open);\n setOpenState(open);\n };\n\n return (\n <ChatContextProvider icons={icons} labels={labels} open={openState} setOpen={setOpen}>\n {children}\n <div className={className}>\n <Button></Button>\n <Window\n clickOutsideToClose={clickOutsideToClose}\n shortcut={shortcut}\n hitEscapeToClose={hitEscapeToClose}\n >\n <Header />\n <CopilotChat\n instructions={instructions}\n onSubmitMessage={onSubmitMessage}\n makeSystemMessage={makeSystemMessage}\n showResponseButton={showResponseButton}\n onInProgress={onInProgress}\n Messages={Messages}\n Input={Input}\n ResponseButton={ResponseButton}\n />\n </Window>\n </div>\n </ChatContextProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AA4FV,cACA,YADA;AAlCD,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA,cAAc;AAAA,EACd,sBAAsB;AAAA,EACtB,mBAAmB;AAAA,EACnB;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAqB;AAAA,EACrB;AAAA,EACA,QAAAA,UAAS;AAAA,EACT,QAAAC,UAAS;AAAA,EACT,QAAAC,UAAS;AAAA,EACT,UAAAC,YAAW;AAAA,EACX,OAAAC,SAAQ;AAAA,EACR,gBAAAC,kBAAiB;AAAA,EACjB;AAAA,EACA;AACF,MAAyB;AACvB,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,WAAW;AAE5D,QAAM,UAAU,CAAC,SAAkB;AACjC,YAAQ,IAAI,aAAa,IAAI;AAC7B,2CAAY;AACZ,iBAAa,IAAI;AAAA,EACnB;AAEA,SACE,qBAAC,uBAAoB,OAAc,QAAgB,MAAM,WAAW,SACjE;AAAA;AAAA,IACD,qBAAC,SAAI,WACH;AAAA,0BAACJ,SAAA,EAAO;AAAA,MACR;AAAA,QAACD;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UAEA;AAAA,gCAACE,SAAA,EAAO;AAAA,YACR;AAAA,cAAC;AAAA;AAAA,gBACC;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA,UAAUC;AAAA,gBACV,OAAOC;AAAA,gBACP,gBAAgBC;AAAA;AAAA,YAClB;AAAA;AAAA;AAAA,MACF;AAAA,OACF;AAAA,KACF;AAEJ;","names":["Window","Button","Header","Messages","Input","ResponseButton"]}
@@ -4,15 +4,15 @@ import {
4
4
 
5
5
  // src/components/chat/Header.tsx
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
- var Header = ({ setOpen }) => {
8
- const context = useChatContext();
7
+ var Header = ({}) => {
8
+ const { setOpen, icons, labels } = useChatContext();
9
9
  return /* @__PURE__ */ jsxs("div", { className: "copilotKitHeader", children: [
10
- /* @__PURE__ */ jsx("div", { children: context.labels.title }),
11
- /* @__PURE__ */ jsx("button", { onClick: () => setOpen(false), "aria-label": "Close", children: context.icons.headerCloseIcon })
10
+ /* @__PURE__ */ jsx("div", { children: labels.title }),
11
+ /* @__PURE__ */ jsx("button", { onClick: () => setOpen(false), "aria-label": "Close", children: icons.headerCloseIcon })
12
12
  ] });
13
13
  };
14
14
 
15
15
  export {
16
16
  Header
17
17
  };
18
- //# sourceMappingURL=chunk-SE6DAYSX.mjs.map
18
+ //# sourceMappingURL=chunk-FLV3J3VX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Header.tsx"],"sourcesContent":["import { HeaderProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\n\nexport const Header = ({}: HeaderProps) => {\n const { setOpen, icons, labels } = useChatContext();\n\n return (\n <div className=\"copilotKitHeader\">\n <div>{labels.title}</div>\n <button onClick={() => setOpen(false)} aria-label=\"Close\">\n {icons.headerCloseIcon}\n </button>\n </div>\n );\n};\n"],"mappings":";;;;;AAOI,SACE,KADF;AAJG,IAAM,SAAS,CAAC,CAAC,MAAmB;AACzC,QAAM,EAAE,SAAS,OAAO,OAAO,IAAI,eAAe;AAElD,SACE,qBAAC,SAAI,WAAU,oBACb;AAAA,wBAAC,SAAK,iBAAO,OAAM;AAAA,IACnB,oBAAC,YAAO,SAAS,MAAM,QAAQ,KAAK,GAAG,cAAW,SAC/C,gBAAM,iBACT;AAAA,KACF;AAEJ;","names":[]}
@@ -1,15 +1,18 @@
1
+ import {
2
+ useChatContext
3
+ } from "./chunk-BJPGMY3I.mjs";
4
+
1
5
  // src/components/chat/Window.tsx
2
6
  import React, { useCallback, useEffect } from "react";
3
7
  import { jsx } from "react/jsx-runtime";
4
8
  var Window = ({
5
- open,
6
- setOpen,
7
9
  children,
8
10
  clickOutsideToClose,
9
11
  shortcut,
10
12
  hitEscapeToClose
11
13
  }) => {
12
14
  const windowRef = React.useRef(null);
15
+ const { open, setOpen } = useChatContext();
13
16
  const handleClickOutside = useCallback(
14
17
  (event) => {
15
18
  var _a;
@@ -112,4 +115,4 @@ function isMacOS() {
112
115
  export {
113
116
  Window
114
117
  };
115
- //# sourceMappingURL=chunk-LLOSOTAT.mjs.map
118
+ //# sourceMappingURL=chunk-FO7Z5LAL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Window.tsx"],"sourcesContent":["import React, { useCallback, useEffect } from \"react\";\nimport { WindowProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\n\nexport const Window = ({\n children,\n clickOutsideToClose,\n shortcut,\n hitEscapeToClose,\n}: WindowProps) => {\n const windowRef = React.useRef<HTMLDivElement>(null);\n\n const { open, setOpen } = useChatContext();\n\n const handleClickOutside = useCallback(\n (event: MouseEvent) => {\n if (!clickOutsideToClose) {\n return;\n }\n\n const parentElement = windowRef.current?.parentElement;\n\n let className = \"\";\n if (event.target instanceof HTMLElement) {\n className = event.target.className;\n }\n\n if (\n open &&\n parentElement &&\n !parentElement.contains(event.target as any) &&\n // prevent closing the window when clicking on the debug menu\n !className.includes(\"copilotKitDebugMenu\")\n ) {\n setOpen(false);\n }\n },\n [clickOutsideToClose, open, setOpen],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n const target = event.target as HTMLElement;\n const isInput =\n target.tagName === \"INPUT\" ||\n target.tagName === \"SELECT\" ||\n target.tagName === \"TEXTAREA\" ||\n target.isContentEditable;\n\n const isDescendantOfWrapper = windowRef.current?.contains(target);\n\n if (\n open &&\n event.key === \"Escape\" &&\n (!isInput || isDescendantOfWrapper) &&\n hitEscapeToClose\n ) {\n setOpen(false);\n } else if (\n event.key === shortcut &&\n ((isMacOS() && event.metaKey) || (!isMacOS() && event.ctrlKey)) &&\n (!isInput || isDescendantOfWrapper)\n ) {\n setOpen(!open);\n }\n },\n [hitEscapeToClose, shortcut, open, setOpen],\n );\n\n const adjustForMobile = useCallback(() => {\n const copilotKitWindow = windowRef.current;\n const vv = window.visualViewport;\n if (!copilotKitWindow || !vv) {\n return;\n }\n\n if (window.innerWidth < 640 && open) {\n copilotKitWindow.style.height = `${vv.height}px`;\n copilotKitWindow.style.left = `${vv.offsetLeft}px`;\n copilotKitWindow.style.top = `${vv.offsetTop}px`;\n\n document.body.style.position = \"fixed\";\n document.body.style.width = \"100%\";\n document.body.style.height = `${window.innerHeight}px`;\n document.body.style.overflow = \"hidden\";\n document.body.style.touchAction = \"none\";\n\n // Prevent scrolling on iOS\n document.body.addEventListener(\"touchmove\", preventScroll, {\n passive: false,\n });\n } else {\n copilotKitWindow.style.height = \"\";\n copilotKitWindow.style.left = \"\";\n copilotKitWindow.style.top = \"\";\n document.body.style.position = \"\";\n document.body.style.height = \"\";\n document.body.style.width = \"\";\n document.body.style.overflow = \"\";\n document.body.style.top = \"\";\n document.body.style.touchAction = \"\";\n\n document.body.removeEventListener(\"touchmove\", preventScroll);\n }\n }, [open]);\n\n useEffect(() => {\n document.addEventListener(\"mousedown\", handleClickOutside);\n document.addEventListener(\"keydown\", handleKeyDown);\n if (window.visualViewport) {\n window.visualViewport.addEventListener(\"resize\", adjustForMobile);\n adjustForMobile();\n }\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n document.removeEventListener(\"keydown\", handleKeyDown);\n if (window.visualViewport) {\n window.visualViewport.removeEventListener(\"resize\", adjustForMobile);\n }\n };\n }, [adjustForMobile, handleClickOutside, handleKeyDown]);\n\n return (\n <div className={`copilotKitWindow${open ? \" open\" : \"\"}`} ref={windowRef}>\n {children}\n </div>\n );\n};\n\nconst preventScroll = (event: TouchEvent): void => {\n let targetElement = event.target as Element;\n\n // Function to check if the target has the parent with a given class\n const hasParentWithClass = (element: Element, className: string): boolean => {\n while (element && element !== document.body) {\n if (element.classList.contains(className)) {\n return true;\n }\n element = element.parentElement!;\n }\n return false;\n };\n\n // Check if the target of the touch event is inside an element with the 'copilotKitMessages' class\n if (!hasParentWithClass(targetElement, \"copilotKitMessages\")) {\n event.preventDefault();\n }\n};\n\nfunction isMacOS() {\n return /Mac|iMac|Macintosh/i.test(navigator.userAgent);\n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,WAAW,mBAAmB,OAAO,UAAU,MAAM,KAAK,WAC5D,UACH;AAEJ;AAEA,IAAM,gBAAgB,CAAC,UAA4B;AACjD,MAAI,gBAAgB,MAAM;AAG1B,QAAM,qBAAqB,CAAC,SAAkB,cAA+B;AAC3E,WAAO,WAAW,YAAY,SAAS,MAAM;AAC3C,UAAI,QAAQ,UAAU,SAAS,SAAS,GAAG;AACzC,eAAO;AAAA,MACT;AACA,gBAAU,QAAQ;AAAA,IACpB;AACA,WAAO;AAAA,EACT;AAGA,MAAI,CAAC,mBAAmB,eAAe,oBAAoB,GAAG;AAC5D,UAAM,eAAe;AAAA,EACvB;AACF;AAEA,SAAS,UAAU;AACjB,SAAO,sBAAsB,KAAK,UAAU,SAAS;AACvD;","names":[]}
@@ -13,7 +13,8 @@ import {
13
13
  ActionExecutionMessage,
14
14
  ResultMessage,
15
15
  TextMessage,
16
- Role
16
+ Role,
17
+ AgentStateMessage
17
18
  } from "@copilotkit/runtime-client-gql";
18
19
  import { jsx, jsxs } from "react/jsx-runtime";
19
20
  var Messages = ({ messages, inProgress, children }) => {
@@ -55,8 +56,8 @@ var Messages = ({ messages, inProgress, children }) => {
55
56
  } else if (message instanceof TextMessage && message.role == "assistant") {
56
57
  return /* @__PURE__ */ jsx("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: isCurrentMessage && inProgress && !message.content ? context.icons.spinnerIcon : /* @__PURE__ */ jsx(Markdown, { content: message.content }) }, index);
57
58
  } else if (message instanceof ActionExecutionMessage) {
58
- if (chatComponentsCache.current !== null && chatComponentsCache.current[message.name]) {
59
- const render = chatComponentsCache.current[message.name];
59
+ if (chatComponentsCache.current !== null && chatComponentsCache.current.actions[message.name]) {
60
+ const render = chatComponentsCache.current.actions[message.name];
60
61
  if (typeof render === "string") {
61
62
  if (isCurrentMessage && inProgress) {
62
63
  return /* @__PURE__ */ jsxs("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
@@ -98,6 +99,50 @@ var Messages = ({ messages, inProgress, children }) => {
98
99
  } else {
99
100
  return /* @__PURE__ */ jsx("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: context.icons.spinnerIcon }, index);
100
101
  }
102
+ } else if (message instanceof AgentStateMessage) {
103
+ let render;
104
+ if (chatComponentsCache.current !== null) {
105
+ render = chatComponentsCache.current.coagentActions[`${message.agentName}-${message.nodeName}`] || chatComponentsCache.current.coagentActions[`${message.agentName}-global`];
106
+ }
107
+ if (render) {
108
+ if (typeof render === "string") {
109
+ if (isCurrentMessage && inProgress) {
110
+ return /* @__PURE__ */ jsxs("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
111
+ context.icons.spinnerIcon,
112
+ " ",
113
+ /* @__PURE__ */ jsx("span", { className: "inProgressLabel", children: render })
114
+ ] }, index);
115
+ } else {
116
+ return null;
117
+ }
118
+ } else {
119
+ const state = message.state;
120
+ let status = message.active ? "inProgress" : "complete";
121
+ const toRender = render({
122
+ status,
123
+ state,
124
+ nodeName: message.nodeName
125
+ });
126
+ if (!toRender && status === "complete") {
127
+ return null;
128
+ }
129
+ if (typeof toRender === "string") {
130
+ return /* @__PURE__ */ jsxs("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
131
+ isCurrentMessage && inProgress && context.icons.spinnerIcon,
132
+ " ",
133
+ toRender
134
+ ] }, index);
135
+ } else {
136
+ return /* @__PURE__ */ jsx("div", { className: "copilotKitCustomAssistantMessage", children: toRender }, index);
137
+ }
138
+ }
139
+ } else if (!inProgress || !isCurrentMessage) {
140
+ return null;
141
+ } else {
142
+ return /* @__PURE__ */ jsx("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: context.icons.spinnerIcon }, index);
143
+ }
144
+ } else if (message instanceof ResultMessage && inProgress && isCurrentMessage) {
145
+ return /* @__PURE__ */ jsx("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: context.icons.spinnerIcon }, index);
101
146
  }
102
147
  }),
103
148
  /* @__PURE__ */ jsx("footer", { ref: messagesEndRef, children })
@@ -123,4 +168,4 @@ function makeInitialMessages(initial) {
123
168
  export {
124
169
  Messages
125
170
  };
126
- //# sourceMappingURL=chunk-4Z2WDXSK.mjs.map
171
+ //# sourceMappingURL=chunk-FOZVHL73.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Messages.tsx"],"sourcesContent":["import React, { useEffect, useMemo } from \"react\";\nimport { MessagesProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\nimport { Markdown } from \"./Markdown\";\nimport { RenderFunctionStatus, useCopilotContext } from \"@copilotkit/react-core\";\nimport {\n MessageStatusCode,\n ActionExecutionMessage,\n Message,\n ResultMessage,\n TextMessage,\n Role,\n AgentStateMessage,\n} from \"@copilotkit/runtime-client-gql\";\nimport { CoagentInChatRenderFunction } from \"@copilotkit/react-core/dist/context/copilot-context\";\n\nexport const Messages = ({ messages, inProgress, children }: MessagesProps) => {\n const { chatComponentsCache } = useCopilotContext();\n\n const context = useChatContext();\n const initialMessages = useMemo(\n () => makeInitialMessages(context.labels.initial),\n [context.labels.initial],\n );\n messages = [...initialMessages, ...messages];\n\n const functionResults: Record<string, string> = {};\n\n for (let i = 0; i < messages.length; i++) {\n if (messages[i] instanceof ActionExecutionMessage) {\n const id = messages[i].id;\n const resultMessage: ResultMessage | undefined = messages.find(\n (message) => message instanceof ResultMessage && message.actionExecutionId === id,\n ) as ResultMessage | undefined;\n\n if (resultMessage) {\n functionResults[id] = ResultMessage.decodeResult(resultMessage.result || \"\");\n }\n }\n }\n\n const messagesEndRef = React.useRef<HTMLDivElement>(null);\n\n const scrollToBottom = () => {\n if (messagesEndRef.current) {\n messagesEndRef.current.scrollIntoView({\n behavior: \"auto\",\n });\n }\n };\n\n useEffect(() => {\n scrollToBottom();\n }, [messages]);\n\n return (\n <div className=\"copilotKitMessages\">\n {messages.map((message, index) => {\n const isCurrentMessage = index === messages.length - 1;\n\n if (message instanceof TextMessage && message.role === \"user\") {\n return (\n <div key={index} className=\"copilotKitMessage copilotKitUserMessage\">\n {message.content}\n </div>\n );\n } else if (message instanceof TextMessage && message.role == \"assistant\") {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {isCurrentMessage && inProgress && !message.content ? (\n context.icons.spinnerIcon\n ) : (\n <Markdown content={message.content} />\n )}\n </div>\n );\n } else if (message instanceof ActionExecutionMessage) {\n if (\n chatComponentsCache.current !== null &&\n chatComponentsCache.current.actions[message.name]\n ) {\n const render = chatComponentsCache.current.actions[message.name];\n // render a static string\n if (typeof render === \"string\") {\n // when render is static, we show it only when in progress\n if (isCurrentMessage && inProgress) {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {context.icons.spinnerIcon} <span className=\"inProgressLabel\">{render}</span>\n </div>\n );\n }\n // Done - silent by default to avoid a series of \"done\" messages\n else {\n return null;\n }\n }\n // render is a function\n else {\n const args = message.arguments;\n\n let status: RenderFunctionStatus = \"inProgress\";\n\n if (functionResults[message.id] !== undefined) {\n status = \"complete\";\n } else if (message.status.code !== MessageStatusCode.Pending) {\n status = \"executing\";\n }\n\n const toRender = render({\n status: status as any,\n args,\n result: functionResults[message.id],\n });\n\n // No result and complete: stay silent\n if (!toRender && status === \"complete\") {\n return null;\n }\n\n if (typeof toRender === \"string\") {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {isCurrentMessage && inProgress && context.icons.spinnerIcon} {toRender}\n </div>\n );\n } else {\n return (\n <div key={index} className=\"copilotKitCustomAssistantMessage\">\n {toRender}\n </div>\n );\n }\n }\n }\n // No render function found- show the default message\n else if (!inProgress || !isCurrentMessage) {\n // Done - silent by default to avoid a series of \"done\" messages\n return null;\n } else {\n // In progress\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {context.icons.spinnerIcon}\n </div>\n );\n }\n } else if (message instanceof AgentStateMessage) {\n let render: string | CoagentInChatRenderFunction | undefined;\n\n if (chatComponentsCache.current !== null) {\n render =\n chatComponentsCache.current.coagentActions[\n `${message.agentName}-${message.nodeName}`\n ] || chatComponentsCache.current.coagentActions[`${message.agentName}-global`];\n }\n\n if (render) {\n // render a static string\n if (typeof render === \"string\") {\n // when render is static, we show it only when in progress\n if (isCurrentMessage && inProgress) {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {context.icons.spinnerIcon} <span className=\"inProgressLabel\">{render}</span>\n </div>\n );\n }\n // Done - silent by default to avoid a series of \"done\" messages\n else {\n return null;\n }\n }\n // render is a function\n else {\n const state = message.state;\n\n let status = message.active ? \"inProgress\" : \"complete\";\n\n const toRender = render({\n status: status as any,\n state,\n nodeName: message.nodeName,\n });\n\n // No result and complete: stay silent\n if (!toRender && status === \"complete\") {\n return null;\n }\n\n if (typeof toRender === \"string\") {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {isCurrentMessage && inProgress && context.icons.spinnerIcon} {toRender}\n </div>\n );\n } else {\n return (\n <div key={index} className=\"copilotKitCustomAssistantMessage\">\n {toRender}\n </div>\n );\n }\n }\n }\n // No render function found- show the default message\n else if (!inProgress || !isCurrentMessage) {\n // Done - silent by default to avoid a series of \"done\" messages\n return null;\n } else {\n // In progress\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {context.icons.spinnerIcon}\n </div>\n );\n }\n } else if (message instanceof ResultMessage && inProgress && isCurrentMessage) {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {context.icons.spinnerIcon}\n </div>\n );\n }\n })}\n <footer ref={messagesEndRef}>{children}</footer>\n </div>\n );\n};\n\nfunction makeInitialMessages(initial?: string | string[]): Message[] {\n let initialArray: string[] = [];\n if (initial) {\n if (Array.isArray(initial)) {\n initialArray.push(...initial);\n } else {\n initialArray.push(initial);\n }\n }\n\n return initialArray.map(\n (message) =>\n new TextMessage({\n role: Role.Assistant,\n content: message,\n }),\n );\n}\n"],"mappings":";;;;;;;;AAAA,OAAO,SAAS,WAAW,eAAe;AAI1C,S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,MACF,WAAW,mBAAmB,iBAAiB,cAAc,kBAAkB;AAC7E,eACE,oBAAC,SAAgB,WAAW,gDACzB,kBAAQ,MAAM,eADP,KAEV;AAAA,MAEJ;AAAA,IACF,CAAC;AAAA,IACD,oBAAC,YAAO,KAAK,gBAAiB,UAAS;AAAA,KACzC;AAEJ;AAEA,SAAS,oBAAoB,SAAwC;AACnE,MAAI,eAAyB,CAAC;AAC9B,MAAI,SAAS;AACX,QAAI,MAAM,QAAQ,OAAO,GAAG;AAC1B,mBAAa,KAAK,GAAG,OAAO;AAAA,IAC9B,OAAO;AACL,mBAAa,KAAK,OAAO;AAAA,IAC3B;AAAA,EACF;AAEA,SAAO,aAAa;AAAA,IAClB,CAAC,YACC,IAAI,YAAY;AAAA,MACd,MAAM,KAAK;AAAA,MACX,SAAS;AAAA,IACX,CAAC;AAAA,EACL;AACF;","names":[]}
@@ -4,6 +4,8 @@ import {
4
4
 
5
5
  // src/components/dev-console/utils.ts
6
6
  import { defaultCopilotContextCategories } from "@copilotkit/react-core";
7
+ import { ActionExecutionMessage, ResultMessage, TextMessage } from "@copilotkit/runtime-client-gql";
8
+ import { AgentStateMessage } from "@copilotkit/runtime-client-gql";
7
9
  function shouldShowDevConsole(showDevConsole) {
8
10
  if (typeof showDevConsole === "boolean") {
9
11
  return showDevConsole;
@@ -64,6 +66,7 @@ function getPublishedCopilotKitVersion(current, forceCheck = false) {
64
66
  });
65
67
  }
66
68
  function logReadables(context) {
69
+ console.log("%cCurrent Readables:", "font-size: 16px; font-weight: bold;");
67
70
  const readables = context.getContextString([], defaultCopilotContextCategories).trim();
68
71
  if (readables.length === 0) {
69
72
  console.log("No readables found");
@@ -72,6 +75,7 @@ function logReadables(context) {
72
75
  console.log(readables);
73
76
  }
74
77
  function logActions(context) {
78
+ console.log("%cCurrent Actions:", "font-size: 16px; font-weight: bold;");
75
79
  if (Object.values(context.actions).length === 0) {
76
80
  console.log("No actions found");
77
81
  return;
@@ -84,11 +88,59 @@ function logActions(context) {
84
88
  console.groupEnd();
85
89
  }
86
90
  }
91
+ function logMessages(context) {
92
+ console.log("%cCurrent Messages:", "font-size: 16px; font-weight: bold;");
93
+ if (context.messages.length === 0) {
94
+ console.log("No messages found");
95
+ return;
96
+ }
97
+ const tableData = context.messages.map((message) => {
98
+ if (message instanceof TextMessage) {
99
+ return {
100
+ id: message.id,
101
+ type: "TextMessage",
102
+ role: message.role,
103
+ name: void 0,
104
+ scope: void 0,
105
+ content: message.content
106
+ };
107
+ } else if (message instanceof ActionExecutionMessage) {
108
+ return {
109
+ id: message.id,
110
+ type: "ActionExecutionMessage",
111
+ role: void 0,
112
+ name: message.name,
113
+ scope: message.scope,
114
+ content: message.arguments
115
+ };
116
+ } else if (message instanceof ResultMessage) {
117
+ return {
118
+ id: message.id,
119
+ type: "ResultMessage",
120
+ role: void 0,
121
+ name: message.actionName,
122
+ scope: message.actionExecutionId,
123
+ content: message.result
124
+ };
125
+ } else if (message instanceof AgentStateMessage) {
126
+ return {
127
+ id: message.id,
128
+ type: `AgentStateMessage (running: ${message.running})`,
129
+ role: message.role,
130
+ name: void 0,
131
+ scope: message.threadId,
132
+ content: message.state
133
+ };
134
+ }
135
+ });
136
+ console.table(tableData);
137
+ }
87
138
 
88
139
  export {
89
140
  shouldShowDevConsole,
90
141
  getPublishedCopilotKitVersion,
91
142
  logReadables,
92
- logActions
143
+ logActions,
144
+ logMessages
93
145
  };
94
- //# sourceMappingURL=chunk-PF5HUDUP.mjs.map
146
+ //# sourceMappingURL=chunk-H7TM5JE6.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/dev-console/utils.ts"],"sourcesContent":["import { CopilotContextParams, defaultCopilotContextCategories } from \"@copilotkit/react-core\";\nimport { CopilotKitVersion } from \"./types\";\nimport { ActionExecutionMessage, ResultMessage, TextMessage } from \"@copilotkit/runtime-client-gql\";\nimport { AgentStateMessage } from \"@copilotkit/runtime-client-gql\";\n\nexport function shouldShowDevConsole(showDevConsole: boolean | \"auto\"): boolean {\n if (typeof showDevConsole === \"boolean\") {\n return showDevConsole;\n }\n return (\n getHostname() === \"localhost\" ||\n getHostname() === \"127.0.0.1\" ||\n getHostname() === \"0.0.0.0\" ||\n getHostname() === \"::1\"\n );\n}\n\nfunction getHostname(): string {\n if (typeof window !== \"undefined\" && window.location) {\n return window.location.hostname;\n }\n return \"\";\n}\n\nexport async function getPublishedCopilotKitVersion(\n current: string,\n forceCheck: boolean = false,\n): Promise<CopilotKitVersion> {\n const LOCAL_STORAGE_KEY = \"__copilotkit_version_check__\";\n const serializedVersion = localStorage.getItem(LOCAL_STORAGE_KEY);\n if (serializedVersion && !forceCheck) {\n try {\n const parsedVersion: CopilotKitVersion = JSON.parse(serializedVersion);\n const oneHour = 60 * 60 * 1000;\n const now = new Date().getTime();\n\n if (\n parsedVersion.current === current &&\n now - new Date(parsedVersion.lastChecked).getTime() < oneHour\n ) {\n return parsedVersion;\n }\n } catch (error) {\n console.error(\"Failed to parse CopilotKitVersion from localStorage\", error);\n }\n }\n\n try {\n const response = await fetch(\"https://api.cloud.stagingcopilotkit.ai/check-for-updates\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n packages: [\n {\n packageName: \"@copilotkit/shared\",\n packageVersion: current,\n },\n ],\n }),\n });\n\n const data = await response.json();\n\n const version: CopilotKitVersion = {\n current,\n lastChecked: new Date().getTime(),\n latest: data.packages[0].latestVersion,\n severity: data.packages[0].severity,\n advisory: data.packages[0].advisory || null,\n };\n\n localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(version));\n return version;\n } catch (error) {\n console.error(\"Failed to check for updates\", error);\n throw error;\n }\n}\n\nexport function logReadables(context: CopilotContextParams) {\n console.log(\"%cCurrent Readables:\", \"font-size: 16px; font-weight: bold;\");\n\n const readables = context.getContextString([], defaultCopilotContextCategories).trim();\n if (readables.length === 0) {\n console.log(\"No readables found\");\n return;\n }\n console.log(readables);\n}\n\nexport function logActions(context: CopilotContextParams) {\n console.log(\"%cCurrent Actions:\", \"font-size: 16px; font-weight: bold;\");\n\n if (Object.values(context.actions).length === 0) {\n console.log(\"No actions found\");\n return;\n }\n for (const action of Object.values(context.actions)) {\n console.group(action.name);\n console.log(\"name\", action.name);\n console.log(\"description\", action.description);\n console.log(\"parameters\", action.parameters);\n\n console.groupEnd();\n }\n}\n\nexport function logMessages(context: CopilotContextParams) {\n console.log(\"%cCurrent Messages:\", \"font-size: 16px; font-weight: bold;\");\n\n if (context.messages.length === 0) {\n console.log(\"No messages found\");\n return;\n }\n\n const tableData = context.messages.map((message) => {\n if (message instanceof TextMessage) {\n return {\n id: message.id,\n type: \"TextMessage\",\n role: message.role,\n name: undefined,\n scope: undefined,\n content: message.content,\n };\n } else if (message instanceof ActionExecutionMessage) {\n return {\n id: message.id,\n type: \"ActionExecutionMessage\",\n role: undefined,\n name: message.name,\n scope: message.scope,\n content: message.arguments,\n };\n } else if (message instanceof ResultMessage) {\n return {\n id: message.id,\n type: \"ResultMessage\",\n role: undefined,\n name: message.actionName,\n scope: message.actionExecutionId,\n content: message.result,\n };\n } else if (message instanceof AgentStateMessage) {\n return {\n id: message.id,\n type: `AgentStateMessage (running: ${message.running})`,\n role: message.role,\n name: undefined,\n scope: message.threadId,\n content: message.state,\n };\n }\n });\n console.table(tableData);\n}\n"],"mappings":";;;;;AAAA,SAA+B,uCAAuC;AAEtE,SAAS,wBAAwB,eAAe,mBAAmB;AACnE,SAAS,yBAAyB;AAE3B,SAAS,qBAAqB,gBAA2C;AAC9E,MAAI,OAAO,mBAAmB,WAAW;AACvC,WAAO;AAAA,EACT;AACA,SACE,YAAY,MAAM,eAClB,YAAY,MAAM,eAClB,YAAY,MAAM,aAClB,YAAY,MAAM;AAEtB;AAEA,SAAS,cAAsB;AAC7B,MAAI,OAAO,WAAW,eAAe,OAAO,UAAU;AACpD,WAAO,OAAO,SAAS;AAAA,EACzB;AACA,SAAO;AACT;AAEA,SAAsB,8BACpB,SACA,aAAsB,OACM;AA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AAQ;AAAA,MACnB;AAAA,IACF,WAAW,mBAAmB,mBAAmB;AAC/C,aAAO;AAAA,QACL,IAAI,QAAQ;AAAA,QACZ,MAAM,+BAA+B,QAAQ;AAAA,QAC7C,MAAM,QAAQ;AAAA,QACd,MAAM;AAAA,QACN,OAAO,QAAQ;AAAA,QACf,SAAS,QAAQ;AAAA,MACnB;AAAA,IACF;AAAA,EACF,CAAC;AACD,UAAQ,MAAM,SAAS;AACzB;","names":[]}
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  Suggestion,
3
3
  reloadSuggestions
4
- } from "./chunk-KSCXPA74.mjs";
4
+ } from "./chunk-WCPLXRZX.mjs";
5
5
  import {
6
6
  CopilotDevConsole
7
- } from "./chunk-D6QNFZXK.mjs";
7
+ } from "./chunk-I4QG2ZZU.mjs";
8
8
  import {
9
9
  Input
10
10
  } from "./chunk-U6J5DGOE.mjs";
11
11
  import {
12
12
  Messages
13
- } from "./chunk-4Z2WDXSK.mjs";
13
+ } from "./chunk-FOZVHL73.mjs";
14
14
  import {
15
15
  ResponseButton
16
16
  } from "./chunk-XSUSSWDS.mjs";
@@ -164,4 +164,4 @@ export {
164
164
  WrappedCopilotChat,
165
165
  useCopilotChatLogic
166
166
  };
167
- //# sourceMappingURL=chunk-SWWFXRFF.mjs.map
167
+ //# sourceMappingURL=chunk-HR36Y2FQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Chat.tsx"],"sourcesContent":["/**\n * <br/>\n * <img src=\"/images/CopilotChat.gif\" width=\"500\" />\n *\n * A chatbot panel component for the CopilotKit framework. The component allows for a high degree\n * of customization through various props and custom CSS.\n *\n * ## Install Dependencies\n *\n * This component is part of the [@copilotkit/react-ui](https://npmjs.com/package/@copilotkit/react-ui) package.\n *\n * ```shell npm2yarn \\\"@copilotkit/react-ui\"\\\n * npm install @copilotkit/react-core @copilotkit/react-ui\n * ```\n *\n * ## Usage\n *\n * ```tsx\n * import { CopilotChat } from \"@copilotkit/react-ui\";\n * import \"@copilotkit/react-ui/styles.css\";\n *\n * <CopilotChat\n * labels={{\n * title: \"Your Assistant\",\n * initial: \"Hi! 👋 How can I assist you today?\",\n * }}\n * />\n * ```\n *\n * ### Look & Feel\n *\n * By default, CopilotKit components do not have any styles. You can import CopilotKit's stylesheet at the root of your project:\n * ```tsx fileName=\"YourRootComponent.tsx\" {2}\n * ...\n * import \"@copilotkit/react-ui/styles.css\";\n *\n * export function YourRootComponent() {\n * return (\n * <CopilotKit>\n * ...\n * </CopilotKit>\n * );\n * }\n * ```\n * For more information about how to customize the styles, check out the [Customize Look & Feel](/concepts/customize-look-and-feel) guide.\n */\n\nimport {\n ChatContext,\n ChatContextProvider,\n CopilotChatIcons,\n CopilotChatLabels,\n} from \"./ChatContext\";\nimport { Messages as DefaultMessages } from \"./Messages\";\nimport { Input as DefaultInput } from \"./Input\";\nimport { ResponseButton as DefaultResponseButton } from \"./Response\";\nimport { Suggestion } from \"./Suggestion\";\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { SystemMessageFunction, useCopilotChat, useCopilotContext } from \"@copilotkit/react-core\";\nimport { reloadSuggestions } from \"./Suggestion\";\nimport { CopilotChatSuggestion } from \"../../types/suggestions\";\nimport { Message, Role, TextMessage } from \"@copilotkit/runtime-client-gql\";\nimport { InputProps, MessagesProps, ResponseButtonProps } from \"./props\";\nimport { randomId } from \"@copilotkit/shared\";\n\nimport { CopilotDevConsole } from \"../dev-console\";\n\n/**\n * Props for CopilotChat component.\n */\nexport interface CopilotChatProps {\n /**\n * Custom instructions to be added to the system message. Use this property to\n * provide additional context or guidance to the language model, influencing\n * its responses. These instructions can include specific directions,\n * preferences, or criteria that the model should consider when generating\n * its output, thereby tailoring the conversation more precisely to the\n * user's needs or the application's requirements.\n */\n instructions?: string;\n\n /**\n * A callback that gets called when the in progress state changes.\n */\n onInProgress?: (inProgress: boolean) => void;\n\n /**\n * A callback that gets called when a new message it submitted.\n */\n onSubmitMessage?: (message: string) => void | Promise<void>;\n\n /**\n * Icons can be used to set custom icons for the chat window.\n */\n icons?: CopilotChatIcons;\n\n /**\n * Labels can be used to set custom labels for the chat window.\n */\n labels?: CopilotChatLabels;\n\n /**\n * A function that takes in context string and instructions and returns\n * the system message to include in the chat request.\n * Use this to completely override the system message, when providing\n * instructions is not enough.\n */\n makeSystemMessage?: SystemMessageFunction;\n\n /**\n * Whether to show the response button.\n * @default true\n */\n showResponseButton?: boolean;\n\n /**\n * A custom Messages component to use instead of the default.\n */\n Messages?: React.ComponentType<MessagesProps>;\n\n /**\n * A custom Input component to use instead of the default.\n */\n Input?: React.ComponentType<InputProps>;\n\n /**\n * A custom ResponseButton component to use instead of the default.\n */\n ResponseButton?: React.ComponentType<ResponseButtonProps>;\n\n /**\n * A class name to apply to the root element.\n */\n className?: string;\n\n /**\n * Children to render.\n */\n children?: React.ReactNode;\n}\n\nexport function CopilotChat({\n instructions,\n onSubmitMessage,\n makeSystemMessage,\n showResponseButton = true,\n onInProgress,\n Messages = DefaultMessages,\n Input = DefaultInput,\n ResponseButton = DefaultResponseButton,\n className,\n icons,\n labels,\n}: CopilotChatProps) {\n const context = useCopilotContext();\n\n useEffect(() => {\n context.setChatInstructions(instructions || \"\");\n }, [instructions]);\n\n const {\n visibleMessages,\n isLoading,\n currentSuggestions,\n sendMessage,\n stopGeneration,\n reloadMessages,\n } = useCopilotChatLogic(makeSystemMessage, onInProgress, onSubmitMessage);\n\n const chatContext = React.useContext(ChatContext);\n const isVisible = chatContext ? chatContext.open : true;\n\n return (\n <WrappedCopilotChat icons={icons} labels={labels} className={className}>\n <CopilotDevConsole />\n <Messages messages={visibleMessages} inProgress={isLoading}>\n {currentSuggestions.length > 0 && (\n <div>\n <h6>Suggested:</h6>\n <div className=\"suggestions\">\n {currentSuggestions.map((suggestion, index) => (\n <Suggestion\n key={index}\n title={suggestion.title}\n message={suggestion.message}\n partial={suggestion.partial}\n className={suggestion.className}\n onClick={(message) => sendMessage(message)}\n />\n ))}\n </div>\n </div>\n )}\n {showResponseButton && visibleMessages.length > 0 && (\n <ResponseButton\n onClick={isLoading ? stopGeneration : reloadMessages}\n inProgress={isLoading}\n />\n )}\n </Messages>\n <Input inProgress={isLoading} onSend={sendMessage} isVisible={isVisible} />\n </WrappedCopilotChat>\n );\n}\n\nexport function WrappedCopilotChat({\n children,\n icons,\n labels,\n className,\n}: {\n children: React.ReactNode;\n icons?: CopilotChatIcons;\n labels?: CopilotChatLabels;\n className?: string;\n}) {\n const chatContext = React.useContext(ChatContext);\n if (!chatContext) {\n return (\n <ChatContextProvider icons={icons} labels={labels} open={true} setOpen={() => {}}>\n <div className={`copilotKitChat ${className}`}>{children}</div>\n </ChatContextProvider>\n );\n }\n return <>{children}</>;\n}\n\nconst SUGGESTIONS_DEBOUNCE_TIMEOUT = 1000;\n\nexport const useCopilotChatLogic = (\n makeSystemMessage?: SystemMessageFunction,\n onInProgress?: (isLoading: boolean) => void,\n onSubmitMessage?: (messageContent: string) => Promise<void> | void,\n) => {\n const { visibleMessages, appendMessage, reloadMessages, stopGeneration, isLoading } =\n useCopilotChat({\n id: randomId(),\n makeSystemMessage,\n });\n\n const [currentSuggestions, setCurrentSuggestions] = useState<CopilotChatSuggestion[]>([]);\n const suggestionsAbortControllerRef = useRef<AbortController | null>(null);\n const debounceTimerRef = useRef<any>();\n\n const abortSuggestions = () => {\n suggestionsAbortControllerRef.current?.abort();\n suggestionsAbortControllerRef.current = null;\n };\n\n const context = useCopilotContext();\n\n useEffect(() => {\n onInProgress?.(isLoading);\n\n abortSuggestions();\n\n debounceTimerRef.current = setTimeout(\n () => {\n if (!isLoading && Object.keys(context.chatSuggestionConfiguration).length !== 0) {\n suggestionsAbortControllerRef.current = new AbortController();\n reloadSuggestions(\n context,\n context.chatSuggestionConfiguration,\n setCurrentSuggestions,\n suggestionsAbortControllerRef,\n );\n }\n },\n currentSuggestions.length == 0 ? 0 : SUGGESTIONS_DEBOUNCE_TIMEOUT,\n );\n\n return () => {\n clearTimeout(debounceTimerRef.current);\n };\n }, [isLoading, context.chatSuggestionConfiguration]);\n\n const sendMessage = async (messageContent: string) => {\n abortSuggestions();\n setCurrentSuggestions([]);\n\n const message: Message = new TextMessage({\n content: messageContent,\n role: Role.User,\n });\n\n // Append the message immediately to make it visible\n appendMessage(message);\n\n if (onSubmitMessage) {\n try {\n await onSubmitMessage(messageContent);\n } catch (error) {\n console.error(\"Error in onSubmitMessage:\", error);\n }\n }\n\n return message;\n };\n\n return {\n visibleMessages,\n isLoading,\n currentSuggestions,\n sendMessage,\n stopGeneration,\n reloadMessages,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,OAAO,SAAS,WAAW,QAAQ,gBAAgB;AACnD,SAAgC,gBAAgB,yBAAyB;AAGzE,SAAkB,MAAM,mBAAmB;AAE3C,SAAS,gBAAgB;AA+GnB,SAkDG,UAlDH,KAGI,YAHJ;AAjCC,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAqB;AAAA,EACrB;AAAA,EACA,UAAAA,YAAW;AAAA,EACX,OAAAC,SAAQ;AAAA,EACR,gBAAAC,kBAAiB;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AACF,GAAqB;AACnB,QAAM,UAAU,kBAAkB;AAElC,YAAU,MAAM;AACd,YAAQ,oBAAoB,gBAAgB,EAAE;AAAA,EAChD,GAAG,CAAC,YAAY,CAAC;AAEjB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,oBAAoB,mBAAmB,cAAc,eAAe;AAExE,QAAM,cAAc,MAAM,WAAW,WAAW;AAChD,QAAM,YAAY,cAAc,YAAY,OAAO;AAEnD,SACE,qBAAC,sBAAmB,OAAc,QAAgB,WAChD;AAAA,wBAAC,qBAAkB;AAAA,IACnB,qBAACF,WAAA,EAAS,UAAU,iBAAiB,YAAY,WAC9C;AAAA,yBAAmB,SAAS,KAC3B,qBAAC,S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A,EAC1C;AAEA,QAAM,UAAU,kBAAkB;AAElC,YAAU,MAAM;AACd,iDAAe;AAEf,qBAAiB;AAEjB,qBAAiB,UAAU;AAAA,MACzB,MAAM;AACJ,YAAI,CAAC,aAAa,OAAO,KAAK,QAAQ,2BAA2B,EAAE,WAAW,GAAG;AAC/E,wCAA8B,UAAU,IAAI,gBAAgB;AAC5D;AAAA,YACE;AAAA,YACA,QAAQ;AAAA,YACR;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,MACA,mBAAmB,UAAU,IAAI,IAAI;AAAA,IACvC;AAEA,WAAO,MAAM;AACX,mBAAa,iBAAiB,OAAO;AAAA,IACvC;AAAA,EACF,GAAG,CAAC,WAAW,QAAQ,2BAA2B,CAAC;AAEnD,QAAM,cAAc,CAAO,mBAA2B;AACpD,qBAAiB;AACjB,0BAAsB,CAAC,CAAC;AAExB,UAAM,UAAmB,IAAI,YAAY;AAAA,MACvC,SAAS;AAAA,MACT,MAAM,KAAK;AAAA,IACb,CAAC;AAGD,kBAAc,OAAO;AAErB,QAAI,iBAAiB;AACnB,UAAI;AACF,cAAM,gBAAgB,cAAc;AAAA,MACtC,SAAS,OAAP;AACA,gBAAQ,MAAM,6BAA6B,KAAK;AAAA,MAClD;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["Messages","Input","ResponseButton"]}
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  getPublishedCopilotKitVersion,
3
3
  logActions,
4
+ logMessages,
4
5
  logReadables,
5
6
  shouldShowDevConsole
6
- } from "./chunk-PF5HUDUP.mjs";
7
+ } from "./chunk-H7TM5JE6.mjs";
7
8
  import {
8
9
  CheckIcon,
9
10
  ChevronDownIcon,
@@ -202,6 +203,7 @@ function DebugMenuButton({
202
203
  children: [
203
204
  /* @__PURE__ */ jsx(MenuItem, { children: /* @__PURE__ */ jsx("button", { className: "copilotKitDebugMenuItem", onClick: () => logReadables(context), children: "Log Readables" }) }),
204
205
  /* @__PURE__ */ jsx(MenuItem, { children: /* @__PURE__ */ jsx("button", { className: "copilotKitDebugMenuItem", onClick: () => logActions(context), children: "Log Actions" }) }),
206
+ /* @__PURE__ */ jsx(MenuItem, { children: /* @__PURE__ */ jsx("button", { className: "copilotKitDebugMenuItem", onClick: () => logMessages(context), children: "Log Messages" }) }),
205
207
  /* @__PURE__ */ jsx(MenuItem, { children: /* @__PURE__ */ jsx("button", { className: "copilotKitDebugMenuItem", onClick: () => checkForUpdates(true), children: "Check for Updates" }) }),
206
208
  /* @__PURE__ */ jsx("hr", {}),
207
209
  /* @__PURE__ */ jsx(MenuItem, { children: /* @__PURE__ */ jsx("button", { className: "copilotKitDebugMenuItem", onClick: () => setShowDevConsole(false), children: "Hide Dev Console" }) })
@@ -215,4 +217,4 @@ export {
215
217
  CopilotDevConsole,
216
218
  DebugMenuButton
217
219
  };
218
- //# sourceMappingURL=chunk-D6QNFZXK.mjs.map
220
+ //# sourceMappingURL=chunk-I4QG2ZZU.mjs.map