@copilotkit/react-ui 1.3.16-mme-copilot-suggestions.1 → 1.3.16-mme-reset-chat.2

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 (48) hide show
  1. package/CHANGELOG.md +20 -10
  2. package/dist/{chunk-DTI5DZSK.mjs → chunk-3EYL2DRG.mjs} +5 -5
  3. package/dist/{chunk-T7DQWLTN.mjs → chunk-3JNDMHS4.mjs} +2 -2
  4. package/dist/{chunk-PIK3RYPJ.mjs → chunk-AX7CAT7V.mjs} +2 -2
  5. package/dist/{chunk-UYT3USIS.mjs → chunk-NLIDKNNS.mjs} +5 -5
  6. package/dist/{chunk-W3TDOLUY.mjs → chunk-RS6UPR5N.mjs} +8 -8
  7. package/dist/chunk-T26KLXLH.mjs +1 -0
  8. package/dist/{chunk-HGQFDT5I.mjs → chunk-Z2UZSN3K.mjs} +1 -1
  9. package/dist/chunk-Z2UZSN3K.mjs.map +1 -0
  10. package/dist/components/chat/Chat.mjs +5 -5
  11. package/dist/components/chat/Modal.mjs +6 -6
  12. package/dist/components/chat/Popup.mjs +7 -7
  13. package/dist/components/chat/Sidebar.mjs +7 -7
  14. package/dist/components/chat/index.mjs +8 -8
  15. package/dist/components/chat/messages/RenderTextMessage.mjs +1 -1
  16. package/dist/components/dev-console/console.mjs +2 -2
  17. package/dist/components/dev-console/index.mjs +2 -2
  18. package/dist/components/index.mjs +8 -8
  19. package/dist/hooks/index.d.ts +0 -2
  20. package/dist/hooks/index.js +2 -136
  21. package/dist/hooks/index.js.map +1 -1
  22. package/dist/hooks/index.mjs +3 -7
  23. package/dist/hooks/use-copilot-chat-suggestions.d.ts +3 -1
  24. package/dist/hooks/use-copilot-chat-suggestions.js.map +1 -1
  25. package/dist/hooks/use-copilot-chat-suggestions.mjs +1 -1
  26. package/dist/index.d.ts +0 -2
  27. package/dist/index.js +2 -99
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +11 -15
  30. package/package.json +7 -7
  31. package/src/hooks/index.ts +0 -1
  32. package/src/hooks/use-copilot-chat-suggestions.tsx +3 -1
  33. package/dist/chunk-G7A3YV3L.mjs +0 -109
  34. package/dist/chunk-G7A3YV3L.mjs.map +0 -1
  35. package/dist/chunk-HGQFDT5I.mjs.map +0 -1
  36. package/dist/chunk-RJ54B6VE.mjs +0 -1
  37. package/dist/hooks/use-copilot-suggestions.d.ts +0 -79
  38. package/dist/hooks/use-copilot-suggestions.js +0 -160
  39. package/dist/hooks/use-copilot-suggestions.js.map +0 -1
  40. package/dist/hooks/use-copilot-suggestions.mjs +0 -8
  41. package/dist/hooks/use-copilot-suggestions.mjs.map +0 -1
  42. package/src/hooks/use-copilot-suggestions.ts +0 -190
  43. /package/dist/{chunk-DTI5DZSK.mjs.map → chunk-3EYL2DRG.mjs.map} +0 -0
  44. /package/dist/{chunk-T7DQWLTN.mjs.map → chunk-3JNDMHS4.mjs.map} +0 -0
  45. /package/dist/{chunk-PIK3RYPJ.mjs.map → chunk-AX7CAT7V.mjs.map} +0 -0
  46. /package/dist/{chunk-UYT3USIS.mjs.map → chunk-NLIDKNNS.mjs.map} +0 -0
  47. /package/dist/{chunk-W3TDOLUY.mjs.map → chunk-RS6UPR5N.mjs.map} +0 -0
  48. /package/dist/{chunk-RJ54B6VE.mjs.map → chunk-T26KLXLH.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,24 +1,34 @@
1
1
  # ui
2
2
 
3
- ## 1.3.16-mme-copilot-suggestions.1
3
+ ## 1.3.16-mme-reset-chat.2
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Send full instructions as system message
7
+ - Add reset and threadId to useCopilotChat
8
8
  - Updated dependencies
9
- - @copilotkit/runtime-client-gql@1.3.16-mme-copilot-suggestions.1
10
- - @copilotkit/react-core@1.3.16-mme-copilot-suggestions.1
11
- - @copilotkit/shared@1.3.16-mme-copilot-suggestions.1
9
+ - @copilotkit/runtime-client-gql@1.3.16-mme-reset-chat.2
10
+ - @copilotkit/react-core@1.3.16-mme-reset-chat.2
11
+ - @copilotkit/shared@1.3.16-mme-reset-chat.2
12
12
 
13
- ## 1.3.16-mme-copilot-suggestions.0
13
+ ## 1.3.16-mme-improve-langsmith.1
14
14
 
15
15
  ### Patch Changes
16
16
 
17
- - Headless suggestions
17
+ - Ensure the last message is sent to LangSmith
18
18
  - Updated dependencies
19
- - @copilotkit/react-core@1.3.16-mme-copilot-suggestions.0
20
- - @copilotkit/runtime-client-gql@1.3.16-mme-copilot-suggestions.0
21
- - @copilotkit/shared@1.3.16-mme-copilot-suggestions.0
19
+ - @copilotkit/runtime-client-gql@1.3.16-mme-improve-langsmith.1
20
+ - @copilotkit/react-core@1.3.16-mme-improve-langsmith.1
21
+ - @copilotkit/shared@1.3.16-mme-improve-langsmith.1
22
+
23
+ ## 1.3.16-mme-improve-langsmith.0
24
+
25
+ ### Patch Changes
26
+
27
+ - Improve LangSmith support
28
+ - Updated dependencies
29
+ - @copilotkit/react-core@1.3.16-mme-improve-langsmith.0
30
+ - @copilotkit/runtime-client-gql@1.3.16-mme-improve-langsmith.0
31
+ - @copilotkit/shared@1.3.16-mme-improve-langsmith.0
22
32
 
23
33
  ## 1.3.15
24
34
 
@@ -9,16 +9,16 @@ import {
9
9
  } from "./chunk-RQNJNK2W.mjs";
10
10
  import {
11
11
  CopilotChat
12
- } from "./chunk-UYT3USIS.mjs";
13
- import {
14
- ResponseButton
15
- } from "./chunk-3XAXY2Z3.mjs";
12
+ } from "./chunk-NLIDKNNS.mjs";
16
13
  import {
17
14
  Input
18
15
  } from "./chunk-4LUMV4YO.mjs";
19
16
  import {
20
17
  Messages
21
18
  } from "./chunk-CPMIEVKK.mjs";
19
+ import {
20
+ ResponseButton
21
+ } from "./chunk-3XAXY2Z3.mjs";
22
22
  import {
23
23
  ChatContextProvider
24
24
  } from "./chunk-CBBFRI3Q.mjs";
@@ -88,4 +88,4 @@ var CopilotModal = ({
88
88
  export {
89
89
  CopilotModal
90
90
  };
91
- //# sourceMappingURL=chunk-DTI5DZSK.mjs.map
91
+ //# sourceMappingURL=chunk-3EYL2DRG.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-DTI5DZSK.mjs";
3
+ } from "./chunk-3EYL2DRG.mjs";
4
4
  import {
5
5
  __spreadProps,
6
6
  __spreadValues
@@ -27,4 +27,4 @@ function CopilotSidebar(props) {
27
27
  export {
28
28
  CopilotSidebar
29
29
  };
30
- //# sourceMappingURL=chunk-T7DQWLTN.mjs.map
30
+ //# sourceMappingURL=chunk-3JNDMHS4.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-DTI5DZSK.mjs";
3
+ } from "./chunk-3EYL2DRG.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-PIK3RYPJ.mjs.map
21
+ //# sourceMappingURL=chunk-AX7CAT7V.mjs.map
@@ -10,22 +10,22 @@ import {
10
10
  import {
11
11
  RenderTextMessage
12
12
  } from "./chunk-RU73BEZM.mjs";
13
- import {
14
- ResponseButton
15
- } from "./chunk-3XAXY2Z3.mjs";
16
13
  import {
17
14
  Suggestion,
18
15
  reloadSuggestions
19
16
  } from "./chunk-RJCZRKTV.mjs";
20
17
  import {
21
18
  CopilotDevConsole
22
- } from "./chunk-W3TDOLUY.mjs";
19
+ } from "./chunk-RS6UPR5N.mjs";
23
20
  import {
24
21
  Input
25
22
  } from "./chunk-4LUMV4YO.mjs";
26
23
  import {
27
24
  Messages
28
25
  } from "./chunk-CPMIEVKK.mjs";
26
+ import {
27
+ ResponseButton
28
+ } from "./chunk-3XAXY2Z3.mjs";
29
29
  import {
30
30
  ChatContext,
31
31
  ChatContextProvider
@@ -198,4 +198,4 @@ export {
198
198
  WrappedCopilotChat,
199
199
  useCopilotChatLogic
200
200
  };
201
- //# sourceMappingURL=chunk-UYT3USIS.mjs.map
201
+ //# sourceMappingURL=chunk-NLIDKNNS.mjs.map
@@ -1,10 +1,3 @@
1
- import {
2
- CheckIcon,
3
- ChevronDownIcon,
4
- CopilotKitIcon,
5
- ExclamationMarkIcon,
6
- ExclamationMarkTriangleIcon
7
- } from "./chunk-OTPAZXVR.mjs";
8
1
  import {
9
2
  getPublishedCopilotKitVersion,
10
3
  logActions,
@@ -12,6 +5,13 @@ import {
12
5
  logReadables,
13
6
  shouldShowDevConsole
14
7
  } from "./chunk-4FIGRRFS.mjs";
8
+ import {
9
+ CheckIcon,
10
+ ChevronDownIcon,
11
+ CopilotKitIcon,
12
+ ExclamationMarkIcon,
13
+ ExclamationMarkTriangleIcon
14
+ } from "./chunk-OTPAZXVR.mjs";
15
15
  import {
16
16
  SmallSpinnerIcon
17
17
  } from "./chunk-FZC7X5PK.mjs";
@@ -225,4 +225,4 @@ export {
225
225
  CopilotDevConsole,
226
226
  DebugMenuButton
227
227
  };
228
- //# sourceMappingURL=chunk-W3TDOLUY.mjs.map
228
+ //# sourceMappingURL=chunk-RS6UPR5N.mjs.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-T26KLXLH.mjs.map
@@ -26,4 +26,4 @@ function useCopilotChatSuggestions({
26
26
  export {
27
27
  useCopilotChatSuggestions
28
28
  };
29
- //# sourceMappingURL=chunk-HGQFDT5I.mjs.map
29
+ //# sourceMappingURL=chunk-Z2UZSN3K.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/use-copilot-chat-suggestions.tsx"],"sourcesContent":["/**\n * <Callout type=\"warning\">\n * useCopilotChatSuggestions is experimental. The interface is not final and\n * can change without notice.\n * </Callout>\n *\n * `useCopilotReadable` is a React hook that provides app-state and other information\n * to the Copilot. Optionally, the hook can also handle hierarchical state within your\n * application, passing these parent-child relationships to the Copilot.\n *\n * <br/>\n * <img src=\"/images/use-copilot-chat-suggestions/use-copilot-chat-suggestions.gif\" width=\"500\" />\n *\n * ## Usage\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 * ### Simple Usage\n *\n * ```tsx\n * import { useCopilotChatSuggestions } from \"@copilotkit/react-ui\";\n *\n * export function MyComponent() {\n * const [employees, setEmployees] = useState([]);\n *\n * useCopilotChatSuggestions({\n * instructions: `The following employees are on duty: ${JSON.stringify(employees)}`,\n * });\n * }\n * ```\n *\n * ### Dependency Management\n *\n * ```tsx\n * import { useCopilotChatSuggestions } from \"@copilotkit/react-ui\";\n *\n * export function MyComponent() {\n * useCopilotChatSuggestions(\n * {\n * instructions: \"Suggest the most relevant next actions.\",\n * },\n * [appState],\n * );\n * }\n * ```\n *\n * In the example above, the suggestions are generated based on the given instructions.\n * The hook monitors `appState`, and updates suggestions accordingly whenever it changes.\n *\n * ### Behavior and Lifecycle\n *\n * The hook registers the configuration with the chat context upon component mount and\n * removes it on unmount, ensuring a clean and efficient lifecycle management.\n */\n\nimport { useEffect } from \"react\";\nimport { useCopilotContext } from \"@copilotkit/react-core\";\nimport { randomId } from \"@copilotkit/shared\";\n\ninterface UseCopilotChatSuggestionsConfiguration {\n /**\n * A prompt or instructions for the GPT to generate suggestions.\n */\n instructions: string;\n /**\n * The minimum number of suggestions to generate. Defaults to `1`.\n * @default 1\n */\n minSuggestions?: number;\n /**\n * The maximum number of suggestions to generate. Defaults to `3`.\n * @default 1\n */\n maxSuggestions?: number;\n /**\n * An optional class name to apply to the suggestions.\n */\n className?: string;\n}\n\nexport function useCopilotChatSuggestions(\n {\n instructions,\n className,\n minSuggestions = 1,\n maxSuggestions = 3,\n }: UseCopilotChatSuggestionsConfiguration,\n dependencies: any[] = [],\n) {\n const context = useCopilotContext();\n\n useEffect(() => {\n const id = randomId();\n\n context.addChatSuggestionConfiguration(id, {\n instructions,\n minSuggestions,\n maxSuggestions,\n className,\n });\n\n return () => {\n context.removeChatSuggestionConfiguration(id);\n };\n }, [...dependencies, instructions, minSuggestions, maxSuggestions, className]);\n}\n"],"mappings":";AA6DA,SAAS,iBAAiB;AAC1B,SAAS,yBAAyB;AAClC,SAAS,gBAAgB;AAuBlB,SAAS,0BACd;AAAA,EACE;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB,iBAAiB;AACnB,GACA,eAAsB,CAAC,GACvB;AACA,QAAM,UAAU,kBAAkB;AAElC,YAAU,MAAM;AACd,UAAM,KAAK,SAAS;AAEpB,YAAQ,+BAA+B,IAAI;AAAA,MACzC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,WAAO,MAAM;AACX,cAAQ,kCAAkC,EAAE;AAAA,IAC9C;AAAA,EACF,GAAG,CAAC,GAAG,cAAc,cAAc,gBAAgB,gBAAgB,SAAS,CAAC;AAC/E;","names":[]}
@@ -2,23 +2,23 @@ import {
2
2
  CopilotChat,
3
3
  WrappedCopilotChat,
4
4
  useCopilotChatLogic
5
- } from "../../chunk-UYT3USIS.mjs";
5
+ } from "../../chunk-NLIDKNNS.mjs";
6
6
  import "../../chunk-V7W6IM2V.mjs";
7
7
  import "../../chunk-OMTPWC7T.mjs";
8
8
  import "../../chunk-ZABXREBH.mjs";
9
9
  import "../../chunk-6INMITFA.mjs";
10
10
  import "../../chunk-RU73BEZM.mjs";
11
- import "../../chunk-3XAXY2Z3.mjs";
12
11
  import "../../chunk-RJCZRKTV.mjs";
13
- import "../../chunk-W3TDOLUY.mjs";
14
- import "../../chunk-OTPAZXVR.mjs";
12
+ import "../../chunk-RS6UPR5N.mjs";
15
13
  import "../../chunk-4FIGRRFS.mjs";
14
+ import "../../chunk-OTPAZXVR.mjs";
16
15
  import "../../chunk-4LUMV4YO.mjs";
17
16
  import "../../chunk-YQFVRDNC.mjs";
18
17
  import "../../chunk-YQ3D5IQV.mjs";
19
- import "../../chunk-UPTB2MVO.mjs";
20
18
  import "../../chunk-CPMIEVKK.mjs";
19
+ import "../../chunk-3XAXY2Z3.mjs";
21
20
  import "../../chunk-CBBFRI3Q.mjs";
21
+ import "../../chunk-UPTB2MVO.mjs";
22
22
  import "../../chunk-FZC7X5PK.mjs";
23
23
  import "../../chunk-54JAUBUJ.mjs";
24
24
  import "../../chunk-S5MBUNGN.mjs";
@@ -1,26 +1,26 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "../../chunk-DTI5DZSK.mjs";
3
+ } from "../../chunk-3EYL2DRG.mjs";
4
4
  import "../../chunk-YAGE7RCE.mjs";
5
5
  import "../../chunk-VEC45H6Q.mjs";
6
6
  import "../../chunk-RQNJNK2W.mjs";
7
- import "../../chunk-UYT3USIS.mjs";
7
+ import "../../chunk-NLIDKNNS.mjs";
8
8
  import "../../chunk-V7W6IM2V.mjs";
9
9
  import "../../chunk-OMTPWC7T.mjs";
10
10
  import "../../chunk-ZABXREBH.mjs";
11
11
  import "../../chunk-6INMITFA.mjs";
12
12
  import "../../chunk-RU73BEZM.mjs";
13
- import "../../chunk-3XAXY2Z3.mjs";
14
13
  import "../../chunk-RJCZRKTV.mjs";
15
- import "../../chunk-W3TDOLUY.mjs";
16
- import "../../chunk-OTPAZXVR.mjs";
14
+ import "../../chunk-RS6UPR5N.mjs";
17
15
  import "../../chunk-4FIGRRFS.mjs";
16
+ import "../../chunk-OTPAZXVR.mjs";
18
17
  import "../../chunk-4LUMV4YO.mjs";
19
18
  import "../../chunk-YQFVRDNC.mjs";
20
19
  import "../../chunk-YQ3D5IQV.mjs";
21
- import "../../chunk-UPTB2MVO.mjs";
22
20
  import "../../chunk-CPMIEVKK.mjs";
21
+ import "../../chunk-3XAXY2Z3.mjs";
23
22
  import "../../chunk-CBBFRI3Q.mjs";
23
+ import "../../chunk-UPTB2MVO.mjs";
24
24
  import "../../chunk-FZC7X5PK.mjs";
25
25
  import "../../chunk-54JAUBUJ.mjs";
26
26
  import "../../chunk-S5MBUNGN.mjs";
@@ -1,27 +1,27 @@
1
1
  import {
2
2
  CopilotPopup
3
- } from "../../chunk-PIK3RYPJ.mjs";
4
- import "../../chunk-DTI5DZSK.mjs";
3
+ } from "../../chunk-AX7CAT7V.mjs";
4
+ import "../../chunk-3EYL2DRG.mjs";
5
5
  import "../../chunk-YAGE7RCE.mjs";
6
6
  import "../../chunk-VEC45H6Q.mjs";
7
7
  import "../../chunk-RQNJNK2W.mjs";
8
- import "../../chunk-UYT3USIS.mjs";
8
+ import "../../chunk-NLIDKNNS.mjs";
9
9
  import "../../chunk-V7W6IM2V.mjs";
10
10
  import "../../chunk-OMTPWC7T.mjs";
11
11
  import "../../chunk-ZABXREBH.mjs";
12
12
  import "../../chunk-6INMITFA.mjs";
13
13
  import "../../chunk-RU73BEZM.mjs";
14
- import "../../chunk-3XAXY2Z3.mjs";
15
14
  import "../../chunk-RJCZRKTV.mjs";
16
- import "../../chunk-W3TDOLUY.mjs";
17
- import "../../chunk-OTPAZXVR.mjs";
15
+ import "../../chunk-RS6UPR5N.mjs";
18
16
  import "../../chunk-4FIGRRFS.mjs";
17
+ import "../../chunk-OTPAZXVR.mjs";
19
18
  import "../../chunk-4LUMV4YO.mjs";
20
19
  import "../../chunk-YQFVRDNC.mjs";
21
20
  import "../../chunk-YQ3D5IQV.mjs";
22
- import "../../chunk-UPTB2MVO.mjs";
23
21
  import "../../chunk-CPMIEVKK.mjs";
22
+ import "../../chunk-3XAXY2Z3.mjs";
24
23
  import "../../chunk-CBBFRI3Q.mjs";
24
+ import "../../chunk-UPTB2MVO.mjs";
25
25
  import "../../chunk-FZC7X5PK.mjs";
26
26
  import "../../chunk-54JAUBUJ.mjs";
27
27
  import "../../chunk-S5MBUNGN.mjs";
@@ -1,27 +1,27 @@
1
1
  import {
2
2
  CopilotSidebar
3
- } from "../../chunk-T7DQWLTN.mjs";
4
- import "../../chunk-DTI5DZSK.mjs";
3
+ } from "../../chunk-3JNDMHS4.mjs";
4
+ import "../../chunk-3EYL2DRG.mjs";
5
5
  import "../../chunk-YAGE7RCE.mjs";
6
6
  import "../../chunk-VEC45H6Q.mjs";
7
7
  import "../../chunk-RQNJNK2W.mjs";
8
- import "../../chunk-UYT3USIS.mjs";
8
+ import "../../chunk-NLIDKNNS.mjs";
9
9
  import "../../chunk-V7W6IM2V.mjs";
10
10
  import "../../chunk-OMTPWC7T.mjs";
11
11
  import "../../chunk-ZABXREBH.mjs";
12
12
  import "../../chunk-6INMITFA.mjs";
13
13
  import "../../chunk-RU73BEZM.mjs";
14
- import "../../chunk-3XAXY2Z3.mjs";
15
14
  import "../../chunk-RJCZRKTV.mjs";
16
- import "../../chunk-W3TDOLUY.mjs";
17
- import "../../chunk-OTPAZXVR.mjs";
15
+ import "../../chunk-RS6UPR5N.mjs";
18
16
  import "../../chunk-4FIGRRFS.mjs";
17
+ import "../../chunk-OTPAZXVR.mjs";
19
18
  import "../../chunk-4LUMV4YO.mjs";
20
19
  import "../../chunk-YQFVRDNC.mjs";
21
20
  import "../../chunk-YQ3D5IQV.mjs";
22
- import "../../chunk-UPTB2MVO.mjs";
23
21
  import "../../chunk-CPMIEVKK.mjs";
22
+ import "../../chunk-3XAXY2Z3.mjs";
24
23
  import "../../chunk-CBBFRI3Q.mjs";
24
+ import "../../chunk-UPTB2MVO.mjs";
25
25
  import "../../chunk-FZC7X5PK.mjs";
26
26
  import "../../chunk-54JAUBUJ.mjs";
27
27
  import "../../chunk-S5MBUNGN.mjs";
@@ -1,36 +1,36 @@
1
1
  import "../../chunk-MRFF7GSQ.mjs";
2
2
  import {
3
3
  CopilotSidebar
4
- } from "../../chunk-T7DQWLTN.mjs";
4
+ } from "../../chunk-3JNDMHS4.mjs";
5
5
  import "../../chunk-WB3YULQ4.mjs";
6
6
  import {
7
7
  CopilotPopup
8
- } from "../../chunk-PIK3RYPJ.mjs";
9
- import "../../chunk-DTI5DZSK.mjs";
8
+ } from "../../chunk-AX7CAT7V.mjs";
9
+ import "../../chunk-3EYL2DRG.mjs";
10
10
  import "../../chunk-YAGE7RCE.mjs";
11
11
  import "../../chunk-VEC45H6Q.mjs";
12
12
  import "../../chunk-RQNJNK2W.mjs";
13
13
  import {
14
14
  CopilotChat
15
- } from "../../chunk-UYT3USIS.mjs";
15
+ } from "../../chunk-NLIDKNNS.mjs";
16
16
  import "../../chunk-V7W6IM2V.mjs";
17
17
  import "../../chunk-OMTPWC7T.mjs";
18
18
  import "../../chunk-ZABXREBH.mjs";
19
19
  import "../../chunk-6INMITFA.mjs";
20
20
  import "../../chunk-RU73BEZM.mjs";
21
- import "../../chunk-3XAXY2Z3.mjs";
22
21
  import "../../chunk-RJCZRKTV.mjs";
23
- import "../../chunk-W3TDOLUY.mjs";
24
- import "../../chunk-OTPAZXVR.mjs";
22
+ import "../../chunk-RS6UPR5N.mjs";
25
23
  import "../../chunk-4FIGRRFS.mjs";
24
+ import "../../chunk-OTPAZXVR.mjs";
26
25
  import "../../chunk-4LUMV4YO.mjs";
27
26
  import "../../chunk-YQFVRDNC.mjs";
28
27
  import "../../chunk-YQ3D5IQV.mjs";
29
- import "../../chunk-UPTB2MVO.mjs";
30
28
  import "../../chunk-CPMIEVKK.mjs";
29
+ import "../../chunk-3XAXY2Z3.mjs";
31
30
  import {
32
31
  useChatContext
33
32
  } from "../../chunk-CBBFRI3Q.mjs";
33
+ import "../../chunk-UPTB2MVO.mjs";
34
34
  import "../../chunk-FZC7X5PK.mjs";
35
35
  import "../../chunk-54JAUBUJ.mjs";
36
36
  import "../../chunk-S5MBUNGN.mjs";
@@ -2,8 +2,8 @@ import {
2
2
  RenderTextMessage
3
3
  } from "../../../chunk-RU73BEZM.mjs";
4
4
  import "../../../chunk-YQ3D5IQV.mjs";
5
- import "../../../chunk-UPTB2MVO.mjs";
6
5
  import "../../../chunk-CBBFRI3Q.mjs";
6
+ import "../../../chunk-UPTB2MVO.mjs";
7
7
  import "../../../chunk-FZC7X5PK.mjs";
8
8
  import "../../../chunk-54JAUBUJ.mjs";
9
9
  import "../../../chunk-MRXNTQOX.mjs";
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  CopilotDevConsole,
4
4
  DebugMenuButton
5
- } from "../../chunk-W3TDOLUY.mjs";
6
- import "../../chunk-OTPAZXVR.mjs";
5
+ } from "../../chunk-RS6UPR5N.mjs";
7
6
  import "../../chunk-4FIGRRFS.mjs";
7
+ import "../../chunk-OTPAZXVR.mjs";
8
8
  import "../../chunk-FZC7X5PK.mjs";
9
9
  import "../../chunk-MRXNTQOX.mjs";
10
10
  export {
@@ -1,11 +1,11 @@
1
1
  import "../../chunk-V7W6IM2V.mjs";
2
2
  import {
3
3
  CopilotDevConsole
4
- } from "../../chunk-W3TDOLUY.mjs";
5
- import "../../chunk-OTPAZXVR.mjs";
4
+ } from "../../chunk-RS6UPR5N.mjs";
6
5
  import {
7
6
  shouldShowDevConsole
8
7
  } from "../../chunk-4FIGRRFS.mjs";
8
+ import "../../chunk-OTPAZXVR.mjs";
9
9
  import "../../chunk-FZC7X5PK.mjs";
10
10
  import "../../chunk-MRXNTQOX.mjs";
11
11
  export {
@@ -2,36 +2,36 @@ import "../chunk-JD7BAH7U.mjs";
2
2
  import "../chunk-MRFF7GSQ.mjs";
3
3
  import {
4
4
  CopilotSidebar
5
- } from "../chunk-T7DQWLTN.mjs";
5
+ } from "../chunk-3JNDMHS4.mjs";
6
6
  import "../chunk-WB3YULQ4.mjs";
7
7
  import {
8
8
  CopilotPopup
9
- } from "../chunk-PIK3RYPJ.mjs";
10
- import "../chunk-DTI5DZSK.mjs";
9
+ } from "../chunk-AX7CAT7V.mjs";
10
+ import "../chunk-3EYL2DRG.mjs";
11
11
  import "../chunk-YAGE7RCE.mjs";
12
12
  import "../chunk-VEC45H6Q.mjs";
13
13
  import "../chunk-RQNJNK2W.mjs";
14
14
  import {
15
15
  CopilotChat
16
- } from "../chunk-UYT3USIS.mjs";
16
+ } from "../chunk-NLIDKNNS.mjs";
17
17
  import "../chunk-V7W6IM2V.mjs";
18
18
  import "../chunk-OMTPWC7T.mjs";
19
19
  import "../chunk-ZABXREBH.mjs";
20
20
  import "../chunk-6INMITFA.mjs";
21
21
  import "../chunk-RU73BEZM.mjs";
22
- import "../chunk-3XAXY2Z3.mjs";
23
22
  import "../chunk-RJCZRKTV.mjs";
24
- import "../chunk-W3TDOLUY.mjs";
25
- import "../chunk-OTPAZXVR.mjs";
23
+ import "../chunk-RS6UPR5N.mjs";
26
24
  import "../chunk-4FIGRRFS.mjs";
25
+ import "../chunk-OTPAZXVR.mjs";
27
26
  import "../chunk-4LUMV4YO.mjs";
28
27
  import "../chunk-YQFVRDNC.mjs";
29
28
  import "../chunk-YQ3D5IQV.mjs";
30
- import "../chunk-UPTB2MVO.mjs";
31
29
  import "../chunk-CPMIEVKK.mjs";
30
+ import "../chunk-3XAXY2Z3.mjs";
32
31
  import {
33
32
  useChatContext
34
33
  } from "../chunk-CBBFRI3Q.mjs";
34
+ import "../chunk-UPTB2MVO.mjs";
35
35
  import "../chunk-FZC7X5PK.mjs";
36
36
  import "../chunk-54JAUBUJ.mjs";
37
37
  import "../chunk-S5MBUNGN.mjs";
@@ -1,3 +1 @@
1
1
  export { useCopilotChatSuggestions } from './use-copilot-chat-suggestions.js';
2
- export { SuggestionsResult, UseCopilotSuggestionsConfiguration, useCopilotSuggestions } from './use-copilot-suggestions.js';
3
- import '@copilotkit/shared';
@@ -1,25 +1,8 @@
1
1
  "use strict";
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- }
20
- return a;
21
- };
22
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
6
  var __export = (target, all) => {
24
7
  for (var name in all)
25
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -33,32 +16,11 @@ var __copyProps = (to, from, except, desc) => {
33
16
  return to;
34
17
  };
35
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
- var __async = (__this, __arguments, generator) => {
37
- return new Promise((resolve, reject) => {
38
- var fulfilled = (value) => {
39
- try {
40
- step(generator.next(value));
41
- } catch (e) {
42
- reject(e);
43
- }
44
- };
45
- var rejected = (value) => {
46
- try {
47
- step(generator.throw(value));
48
- } catch (e) {
49
- reject(e);
50
- }
51
- };
52
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
53
- step((generator = generator.apply(__this, __arguments)).next());
54
- });
55
- };
56
19
 
57
20
  // src/hooks/index.ts
58
21
  var hooks_exports = {};
59
22
  __export(hooks_exports, {
60
- useCopilotChatSuggestions: () => useCopilotChatSuggestions,
61
- useCopilotSuggestions: () => useCopilotSuggestions
23
+ useCopilotChatSuggestions: () => useCopilotChatSuggestions
62
24
  });
63
25
  module.exports = __toCommonJS(hooks_exports);
64
26
 
@@ -86,104 +48,8 @@ function useCopilotChatSuggestions({
86
48
  };
87
49
  }, [...dependencies, instructions, minSuggestions, maxSuggestions, className]);
88
50
  }
89
-
90
- // src/hooks/use-copilot-suggestions.ts
91
- var import_react2 = require("react");
92
- var import_react_core2 = require("@copilotkit/react-core");
93
- var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
94
- function useCopilotSuggestions({
95
- instructions,
96
- parameters,
97
- value,
98
- enabled = true,
99
- debounceTime = 1e3
100
- }, dependencies = []) {
101
- const suggestionsAbortControllerRef = (0, import_react2.useRef)(null);
102
- const debounceTimerRef = (0, import_react2.useRef)();
103
- const [suggestions, setSuggestions] = (0, import_react2.useState)({
104
- suggestions: void 0,
105
- isAvailable: false,
106
- isLoading: false
107
- });
108
- const isFirstRunRef = (0, import_react2.useRef)(true);
109
- const abortSuggestions = (0, import_react2.useCallback)(() => {
110
- var _a;
111
- (_a = suggestionsAbortControllerRef.current) == null ? void 0 : _a.abort();
112
- suggestionsAbortControllerRef.current = null;
113
- }, []);
114
- const generalContext = (0, import_react_core2.useCopilotContext)();
115
- const messagesContext = (0, import_react_core2.useCopilotMessagesContext)();
116
- const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
117
- (0, import_react2.useEffect)(() => {
118
- abortSuggestions();
119
- if (!enabled) {
120
- setSuggestions({ suggestions: void 0, isAvailable: false, isLoading: false });
121
- return;
122
- }
123
- if (JSON.stringify(value) === JSON.stringify(suggestions.suggestions)) {
124
- return;
125
- }
126
- debounceTimerRef.current = setTimeout(
127
- () => __async(this, null, function* () {
128
- isFirstRunRef.current = false;
129
- suggestionsAbortControllerRef.current = new AbortController();
130
- setSuggestions(__spreadProps(__spreadValues({}, suggestions), { isLoading: true }));
131
- yield reloadSuggestions(
132
- context,
133
- instructions,
134
- parameters,
135
- value,
136
- suggestionsAbortControllerRef,
137
- setSuggestions
138
- );
139
- }),
140
- isFirstRunRef.current === true ? 0 : debounceTime
141
- );
142
- return () => {
143
- clearTimeout(debounceTimerRef.current);
144
- };
145
- }, [
146
- instructions,
147
- JSON.stringify(parameters),
148
- JSON.stringify(value),
149
- enabled,
150
- debounceTime,
151
- ...dependencies
152
- ]);
153
- return suggestions;
154
- }
155
- function reloadSuggestions(context, instructions, parameters, value, abortControllerRef, setSuggestions) {
156
- return __async(this, null, function* () {
157
- const abortController = abortControllerRef.current;
158
- let fullInstructions = `It's your task to generate suggestions based on the application context.`;
159
- if (instructions) {
160
- fullInstructions += `
161
-
162
- In addition, follow these specific instructions: ${instructions}`;
163
- }
164
- if (value) {
165
- fullInstructions += `
166
-
167
- The current value of the parameter is: ${JSON.stringify(value)}.If it makes sense to complete the existing data, i.e. expand string values, add new elements to arrays, etc., do so. Otherwise, generate a new value.`;
168
- }
169
- yield (0, import_react_core2.extract)({
170
- context,
171
- instructions: instructions || "",
172
- data: fullInstructions,
173
- parameters,
174
- abortSignal: abortController == null ? void 0 : abortController.signal,
175
- requestType: import_runtime_client_gql.CopilotRequestType.Task,
176
- stream({ args, status }) {
177
- if (status === "complete") {
178
- setSuggestions({ suggestions: args, isAvailable: true, isLoading: false });
179
- }
180
- }
181
- });
182
- });
183
- }
184
51
  // Annotate the CommonJS export names for ESM import in node:
185
52
  0 && (module.exports = {
186
- useCopilotChatSuggestions,
187
- useCopilotSuggestions
53
+ useCopilotChatSuggestions
188
54
  });
189
55
  //# sourceMappingURL=index.js.map