@copilotkit/react-ui 1.5.12-next.4 → 1.5.12-next.6

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 (43) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/{chunk-CIP6WIZY.mjs → chunk-DGGCSR5M.mjs} +2 -2
  3. package/dist/{chunk-VN6664CL.mjs → chunk-E5SIPE2R.mjs} +8 -8
  4. package/dist/{chunk-HZGELGAZ.mjs → chunk-F2W5FD7L.mjs} +6 -6
  5. package/dist/{chunk-GUIGQMEU.mjs → chunk-GDOB4BYD.mjs} +2 -2
  6. package/dist/{chunk-RJCZRKTV.mjs → chunk-WGAZXTUA.mjs} +2 -1
  7. package/dist/chunk-WGAZXTUA.mjs.map +1 -0
  8. package/dist/{chunk-3CGR5FXK.mjs → chunk-YGWWZL4N.mjs} +11 -11
  9. package/dist/components/chat/Chat.js +1 -0
  10. package/dist/components/chat/Chat.js.map +1 -1
  11. package/dist/components/chat/Chat.mjs +12 -12
  12. package/dist/components/chat/Modal.js +1 -0
  13. package/dist/components/chat/Modal.js.map +1 -1
  14. package/dist/components/chat/Modal.mjs +14 -14
  15. package/dist/components/chat/Popup.js +1 -0
  16. package/dist/components/chat/Popup.js.map +1 -1
  17. package/dist/components/chat/Popup.mjs +15 -15
  18. package/dist/components/chat/Sidebar.js +1 -0
  19. package/dist/components/chat/Sidebar.js.map +1 -1
  20. package/dist/components/chat/Sidebar.mjs +15 -15
  21. package/dist/components/chat/Suggestion.js +1 -0
  22. package/dist/components/chat/Suggestion.js.map +1 -1
  23. package/dist/components/chat/Suggestion.mjs +1 -1
  24. package/dist/components/chat/index.js +1 -0
  25. package/dist/components/chat/index.js.map +1 -1
  26. package/dist/components/chat/index.mjs +18 -18
  27. package/dist/components/chat/messages/AssistantMessage.mjs +1 -1
  28. package/dist/components/dev-console/console.mjs +3 -3
  29. package/dist/components/dev-console/index.mjs +5 -5
  30. package/dist/components/index.js +1 -0
  31. package/dist/components/index.js.map +1 -1
  32. package/dist/components/index.mjs +22 -22
  33. package/dist/index.js +1 -0
  34. package/dist/index.js.map +1 -1
  35. package/dist/index.mjs +22 -22
  36. package/package.json +4 -4
  37. package/src/components/chat/Suggestion.tsx +1 -0
  38. package/dist/chunk-RJCZRKTV.mjs.map +0 -1
  39. /package/dist/{chunk-CIP6WIZY.mjs.map → chunk-DGGCSR5M.mjs.map} +0 -0
  40. /package/dist/{chunk-VN6664CL.mjs.map → chunk-E5SIPE2R.mjs.map} +0 -0
  41. /package/dist/{chunk-HZGELGAZ.mjs.map → chunk-F2W5FD7L.mjs.map} +0 -0
  42. /package/dist/{chunk-GUIGQMEU.mjs.map → chunk-GDOB4BYD.mjs.map} +0 -0
  43. /package/dist/{chunk-3CGR5FXK.mjs.map → chunk-YGWWZL4N.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # ui
2
2
 
3
+ ## 1.5.12-next.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 6136a57: - fix(errors): add custom error classes to better describe library errors
8
+ - fix(errors): use new errors in error handling
9
+ - chore: add documentation and links to respective errors
10
+ - Updated dependencies [6136a57]
11
+ - @copilotkit/react-core@1.5.12-next.6
12
+ - @copilotkit/runtime-client-gql@1.5.12-next.6
13
+ - @copilotkit/shared@1.5.12-next.6
14
+
15
+ ## 1.5.12-next.5
16
+
17
+ ### Patch Changes
18
+
19
+ - @copilotkit/runtime-client-gql@1.5.12-next.5
20
+ - @copilotkit/react-core@1.5.12-next.5
21
+ - @copilotkit/shared@1.5.12-next.5
22
+
3
23
  ## 1.5.12-next.4
4
24
 
5
25
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-VN6664CL.mjs";
3
+ } from "./chunk-E5SIPE2R.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-CIP6WIZY.mjs.map
30
+ //# sourceMappingURL=chunk-DGGCSR5M.mjs.map
@@ -1,30 +1,30 @@
1
1
  import {
2
2
  Window
3
3
  } from "./chunk-YAGE7RCE.mjs";
4
+ import {
5
+ Header
6
+ } from "./chunk-VEC45H6Q.mjs";
4
7
  import {
5
8
  Button
6
9
  } from "./chunk-RQNJNK2W.mjs";
7
10
  import {
8
11
  CopilotChat
9
- } from "./chunk-3CGR5FXK.mjs";
12
+ } from "./chunk-YGWWZL4N.mjs";
10
13
  import {
11
14
  UserMessage
12
15
  } from "./chunk-HEIDCT7I.mjs";
13
16
  import {
14
17
  AssistantMessage
15
18
  } from "./chunk-3VNMQWGT.mjs";
19
+ import {
20
+ Input
21
+ } from "./chunk-EMQEEXUB.mjs";
16
22
  import {
17
23
  Messages
18
24
  } from "./chunk-34FREWVK.mjs";
19
25
  import {
20
26
  ResponseButton
21
27
  } from "./chunk-3XAXY2Z3.mjs";
22
- import {
23
- Header
24
- } from "./chunk-VEC45H6Q.mjs";
25
- import {
26
- Input
27
- } from "./chunk-EMQEEXUB.mjs";
28
28
  import {
29
29
  ChatContextProvider
30
30
  } from "./chunk-CBBFRI3Q.mjs";
@@ -102,4 +102,4 @@ var CopilotModal = ({
102
102
  export {
103
103
  CopilotModal
104
104
  };
105
- //# sourceMappingURL=chunk-VN6664CL.mjs.map
105
+ //# sourceMappingURL=chunk-E5SIPE2R.mjs.map
@@ -1,6 +1,3 @@
1
- import {
2
- CopilotKitHelpModal
3
- } from "./chunk-TI7SY2RI.mjs";
4
1
  import {
5
2
  getPublishedCopilotKitVersion,
6
3
  logActions,
@@ -9,8 +6,8 @@ import {
9
6
  shouldShowDevConsole
10
7
  } from "./chunk-PNQVKBPN.mjs";
11
8
  import {
12
- SmallSpinnerIcon
13
- } from "./chunk-FZC7X5PK.mjs";
9
+ CopilotKitHelpModal
10
+ } from "./chunk-TI7SY2RI.mjs";
14
11
  import {
15
12
  CheckIcon,
16
13
  ChevronDownIcon,
@@ -18,6 +15,9 @@ import {
18
15
  ExclamationMarkIcon,
19
16
  ExclamationMarkTriangleIcon
20
17
  } from "./chunk-OTPAZXVR.mjs";
18
+ import {
19
+ SmallSpinnerIcon
20
+ } from "./chunk-FZC7X5PK.mjs";
21
21
 
22
22
  // src/components/dev-console/console.tsx
23
23
  import { useCopilotContext, useCopilotMessagesContext } from "@copilotkit/react-core";
@@ -229,4 +229,4 @@ export {
229
229
  CopilotDevConsole,
230
230
  DebugMenuButton
231
231
  };
232
- //# sourceMappingURL=chunk-HZGELGAZ.mjs.map
232
+ //# sourceMappingURL=chunk-F2W5FD7L.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-VN6664CL.mjs";
3
+ } from "./chunk-E5SIPE2R.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-GUIGQMEU.mjs.map
21
+ //# sourceMappingURL=chunk-GDOB4BYD.mjs.map
@@ -22,6 +22,7 @@ function Suggestion({ title, message, onClick, partial, className }) {
22
22
  onClick(message);
23
23
  },
24
24
  className: className || "suggestion",
25
+ "data-test-id": "suggestion",
25
26
  children: [
26
27
  partial && SmallSpinnerIcon,
27
28
  /* @__PURE__ */ jsx("span", { children: title })
@@ -103,4 +104,4 @@ export {
103
104
  Suggestion,
104
105
  reloadSuggestions
105
106
  };
106
- //# sourceMappingURL=chunk-RJCZRKTV.mjs.map
107
+ //# sourceMappingURL=chunk-WGAZXTUA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Suggestion.tsx"],"sourcesContent":["import {\n CopilotContextParams,\n extract,\n CopilotChatSuggestionConfiguration,\n CopilotMessagesContextParams,\n} from \"@copilotkit/react-core\";\nimport { SuggestionsProps } from \"./props\";\nimport { SmallSpinnerIcon } from \"./Icons\";\nimport { CopilotChatSuggestion } from \"../../types/suggestions\";\nimport { actionParametersToJsonSchema } from \"@copilotkit/shared\";\nimport { CopilotRequestType } from \"@copilotkit/runtime-client-gql\";\n\nexport function Suggestion({ title, message, onClick, partial, className }: SuggestionsProps) {\n return (\n <button\n disabled={partial}\n onClick={(e) => {\n e.preventDefault();\n onClick(message);\n }}\n className={className || \"suggestion\"}\n data-test-id=\"suggestion\"\n >\n {partial && SmallSpinnerIcon}\n <span>{title}</span>\n </button>\n );\n}\n\nexport const reloadSuggestions = async (\n context: CopilotContextParams & CopilotMessagesContextParams,\n chatSuggestionConfiguration: { [key: string]: CopilotChatSuggestionConfiguration },\n setCurrentSuggestions: (suggestions: { title: string; message: string }[]) => void,\n abortControllerRef: React.MutableRefObject<AbortController | null>,\n) => {\n const abortController = abortControllerRef.current;\n\n const tools = JSON.stringify(\n Object.values(context.actions).map((action) => ({\n name: action.name,\n description: action.description,\n jsonSchema: JSON.stringify(actionParametersToJsonSchema(action.parameters)),\n })),\n );\n\n const allSuggestions: CopilotChatSuggestion[] = [];\n\n for (const config of Object.values(chatSuggestionConfiguration)) {\n try {\n const numOfSuggestionsInstructions =\n config.minSuggestions === 0\n ? `Produce up to ${config.maxSuggestions} suggestions. ` +\n `If there are no highly relevant suggestions you can think of, provide an empty array.`\n : `Produce between ${config.minSuggestions} and ${config.maxSuggestions} suggestions.`;\n\n const result = await extract({\n context,\n instructions:\n \"Suggest what the user could say next. Provide clear, highly relevant suggestions. Do not literally suggest function calls. \",\n data:\n config.instructions +\n \"\\n\\n\" +\n numOfSuggestionsInstructions +\n \"\\n\\n\" +\n \"Available tools: \" +\n tools +\n \"\\n\\n\",\n requestType: CopilotRequestType.Task,\n parameters: [\n {\n name: \"suggestions\",\n type: \"object[]\",\n attributes: [\n {\n name: \"title\",\n description:\n \"The title of the suggestion. This is shown as a button and should be short.\",\n type: \"string\",\n },\n {\n name: \"message\",\n description:\n \"The message to send when the suggestion is clicked. This should be a clear, complete sentence and will be sent as an instruction to the AI.\",\n type: \"string\",\n },\n ],\n },\n ],\n include: {\n messages: true,\n readable: true,\n },\n abortSignal: abortController?.signal,\n stream: ({ status, args }) => {\n const suggestions = args.suggestions || [];\n const newSuggestions: CopilotChatSuggestion[] = [];\n for (let i = 0; i < suggestions.length; i++) {\n // if GPT provides too many suggestions, limit the number of suggestions\n if (config.maxSuggestions !== undefined && i >= config.maxSuggestions) {\n break;\n }\n const { title, message } = suggestions[i];\n\n // If this is the last suggestion and the status is not complete, mark it as partial\n const partial = i == suggestions.length - 1 && status !== \"complete\";\n\n newSuggestions.push({\n title,\n message,\n partial,\n className: config.className,\n });\n }\n setCurrentSuggestions([...allSuggestions, ...newSuggestions]);\n },\n });\n allSuggestions.push(...result.suggestions);\n } catch (error) {\n console.error(\"Error loading suggestions\", error);\n }\n }\n\n if (abortControllerRef.current === abortController) {\n abortControllerRef.current = null;\n }\n};\n"],"mappings":";;;;;;;;AAAA;AAAA,EAEE;AAAA,OAGK;AAIP,SAAS,oCAAoC;AAC7C,SAAS,0BAA0B;AAI/B,SAUE,KAVF;AAFG,SAAS,WAAW,EAAE,OAAO,SAAS,SAAS,SAAS,UAAU,GAAqB;AAC5F,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,SAAS,CAAC,MAAM;AACd,UAAE,eAAe;AACjB,gBAAQ,OAAO;AAAA,MACjB;AAAA,MACA,WAAW,aAAa;AAAA,MACxB,gBAAa;AAAA,MAEZ;AAAA,mBAAW;AAAA,QACZ,oBAAC,UAAM,iBAAM;AAAA;AAAA;AAAA,EACf;AAEJ;AAEO,IAAM,oBAAoB,CAC/B,SACA,6BACA,uBACA,uBACG;AACH,QAAM,kBAAkB,mBAAmB;AAE3C,QAAM,QAAQ,KAAK;AAAA,IACjB,OAAO,OAAO,QAAQ,OAAO,EAAE,IAAI,CAAC,YAAY;AAAA,MAC9C,MAAM,OAAO;AAAA,MACb,aAAa,OAAO;AAAA,MACpB,Y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AAAA,QAC9D;AAAA,MACF,CAAC;AACD,qBAAe,KAAK,GAAG,OAAO,WAAW;AAAA,IAC3C,SAAS,OAAP;AACA,cAAQ,MAAM,6BAA6B,KAAK;AAAA,IAClD;AAAA,EACF;AAEA,MAAI,mBAAmB,YAAY,iBAAiB;AAClD,uBAAmB,UAAU;AAAA,EAC/B;AACF;","names":[]}
@@ -16,26 +16,26 @@ import {
16
16
  import {
17
17
  RenderActionExecutionMessage
18
18
  } from "./chunk-XB6QCUPB.mjs";
19
- import {
20
- Messages
21
- } from "./chunk-34FREWVK.mjs";
22
- import {
23
- ResponseButton
24
- } from "./chunk-3XAXY2Z3.mjs";
25
19
  import {
26
20
  Suggestion,
27
21
  reloadSuggestions
28
- } from "./chunk-RJCZRKTV.mjs";
22
+ } from "./chunk-WGAZXTUA.mjs";
23
+ import {
24
+ CopilotDevConsole
25
+ } from "./chunk-F2W5FD7L.mjs";
29
26
  import {
30
27
  Input
31
28
  } from "./chunk-EMQEEXUB.mjs";
29
+ import {
30
+ Messages
31
+ } from "./chunk-34FREWVK.mjs";
32
+ import {
33
+ ResponseButton
34
+ } from "./chunk-3XAXY2Z3.mjs";
32
35
  import {
33
36
  ChatContext,
34
37
  ChatContextProvider
35
38
  } from "./chunk-CBBFRI3Q.mjs";
36
- import {
37
- CopilotDevConsole
38
- } from "./chunk-HZGELGAZ.mjs";
39
39
  import {
40
40
  __async,
41
41
  __spreadProps,
@@ -311,4 +311,4 @@ export {
311
311
  WrappedCopilotChat,
312
312
  useCopilotChatLogic
313
313
  };
314
- //# sourceMappingURL=chunk-3CGR5FXK.mjs.map
314
+ //# sourceMappingURL=chunk-YGWWZL4N.mjs.map
@@ -1562,6 +1562,7 @@ function Suggestion({ title, message, onClick, partial, className }) {
1562
1562
  onClick(message);
1563
1563
  },
1564
1564
  className: className || "suggestion",
1565
+ "data-test-id": "suggestion",
1565
1566
  children: [
1566
1567
  partial && SmallSpinnerIcon,
1567
1568
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: title })