@copilotkit/react-ui 1.3.14-fix-handle-execute-agent-error.0 → 1.3.14

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 (59) hide show
  1. package/CHANGELOG.md +5 -5
  2. package/dist/{chunk-47OPG5FM.mjs → chunk-3EYL2DRG.mjs} +3 -3
  3. package/dist/{chunk-KCAVDFB6.mjs → chunk-3JNDMHS4.mjs} +2 -2
  4. package/dist/{chunk-JTINVYPK.mjs → chunk-4LUMV4YO.mjs} +11 -2
  5. package/dist/{chunk-JTINVYPK.mjs.map → chunk-4LUMV4YO.mjs.map} +1 -1
  6. package/dist/{chunk-SWADR6EH.mjs → chunk-AX7CAT7V.mjs} +2 -2
  7. package/dist/{chunk-3KBQXU44.mjs → chunk-NLIDKNNS.mjs} +5 -5
  8. package/dist/{chunk-6BL5C56L.mjs → chunk-OMTPWC7T.mjs} +10 -2
  9. package/dist/chunk-OMTPWC7T.mjs.map +1 -0
  10. package/dist/{chunk-KFQYJ5R5.mjs → chunk-RJCZRKTV.mjs} +3 -3
  11. package/dist/chunk-RJCZRKTV.mjs.map +1 -0
  12. package/dist/chunk-RU73BEZM.mjs +41 -0
  13. package/dist/chunk-RU73BEZM.mjs.map +1 -0
  14. package/dist/components/chat/Chat.js +39 -6
  15. package/dist/components/chat/Chat.js.map +1 -1
  16. package/dist/components/chat/Chat.mjs +5 -5
  17. package/dist/components/chat/Input.js +10 -1
  18. package/dist/components/chat/Input.js.map +1 -1
  19. package/dist/components/chat/Input.mjs +1 -1
  20. package/dist/components/chat/Modal.js +39 -6
  21. package/dist/components/chat/Modal.js.map +1 -1
  22. package/dist/components/chat/Modal.mjs +6 -6
  23. package/dist/components/chat/Popup.js +39 -6
  24. package/dist/components/chat/Popup.js.map +1 -1
  25. package/dist/components/chat/Popup.mjs +7 -7
  26. package/dist/components/chat/Sidebar.js +39 -6
  27. package/dist/components/chat/Sidebar.js.map +1 -1
  28. package/dist/components/chat/Sidebar.mjs +7 -7
  29. package/dist/components/chat/Suggestion.js +2 -2
  30. package/dist/components/chat/Suggestion.js.map +1 -1
  31. package/dist/components/chat/Suggestion.mjs +1 -1
  32. package/dist/components/chat/index.js +39 -6
  33. package/dist/components/chat/index.js.map +1 -1
  34. package/dist/components/chat/index.mjs +8 -8
  35. package/dist/components/chat/messages/RenderActionExecutionMessage.js +9 -1
  36. package/dist/components/chat/messages/RenderActionExecutionMessage.js.map +1 -1
  37. package/dist/components/chat/messages/RenderActionExecutionMessage.mjs +1 -1
  38. package/dist/components/chat/messages/RenderTextMessage.js +18 -2
  39. package/dist/components/chat/messages/RenderTextMessage.js.map +1 -1
  40. package/dist/components/chat/messages/RenderTextMessage.mjs +1 -1
  41. package/dist/components/index.js +39 -6
  42. package/dist/components/index.js.map +1 -1
  43. package/dist/components/index.mjs +8 -8
  44. package/dist/index.js +39 -6
  45. package/dist/index.js.map +1 -1
  46. package/dist/index.mjs +8 -8
  47. package/package.json +7 -7
  48. package/src/components/chat/Input.tsx +6 -1
  49. package/src/components/chat/Suggestion.tsx +7 -3
  50. package/src/components/chat/messages/RenderActionExecutionMessage.tsx +5 -1
  51. package/src/components/chat/messages/RenderTextMessage.tsx +10 -2
  52. package/dist/chunk-6BL5C56L.mjs.map +0 -1
  53. package/dist/chunk-KFQYJ5R5.mjs.map +0 -1
  54. package/dist/chunk-WYMTXCQU.mjs +0 -25
  55. package/dist/chunk-WYMTXCQU.mjs.map +0 -1
  56. /package/dist/{chunk-47OPG5FM.mjs.map → chunk-3EYL2DRG.mjs.map} +0 -0
  57. /package/dist/{chunk-KCAVDFB6.mjs.map → chunk-3JNDMHS4.mjs.map} +0 -0
  58. /package/dist/{chunk-SWADR6EH.mjs.map → chunk-AX7CAT7V.mjs.map} +0 -0
  59. /package/dist/{chunk-3KBQXU44.mjs.map → chunk-NLIDKNNS.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -4,28 +4,28 @@ import "./chunk-JD7BAH7U.mjs";
4
4
  import "./chunk-MRFF7GSQ.mjs";
5
5
  import {
6
6
  CopilotSidebar
7
- } from "./chunk-KCAVDFB6.mjs";
7
+ } from "./chunk-3JNDMHS4.mjs";
8
8
  import "./chunk-WB3YULQ4.mjs";
9
9
  import {
10
10
  CopilotPopup
11
- } from "./chunk-SWADR6EH.mjs";
12
- import "./chunk-47OPG5FM.mjs";
11
+ } from "./chunk-AX7CAT7V.mjs";
12
+ import "./chunk-3EYL2DRG.mjs";
13
13
  import "./chunk-YAGE7RCE.mjs";
14
14
  import "./chunk-VEC45H6Q.mjs";
15
15
  import "./chunk-RQNJNK2W.mjs";
16
16
  import {
17
17
  CopilotChat
18
- } from "./chunk-3KBQXU44.mjs";
18
+ } from "./chunk-NLIDKNNS.mjs";
19
19
  import "./chunk-V7W6IM2V.mjs";
20
- import "./chunk-6BL5C56L.mjs";
20
+ import "./chunk-OMTPWC7T.mjs";
21
21
  import "./chunk-ZABXREBH.mjs";
22
22
  import "./chunk-6INMITFA.mjs";
23
- import "./chunk-WYMTXCQU.mjs";
24
- import "./chunk-KFQYJ5R5.mjs";
23
+ import "./chunk-RU73BEZM.mjs";
24
+ import "./chunk-RJCZRKTV.mjs";
25
25
  import "./chunk-RS6UPR5N.mjs";
26
26
  import "./chunk-4FIGRRFS.mjs";
27
27
  import "./chunk-OTPAZXVR.mjs";
28
- import "./chunk-JTINVYPK.mjs";
28
+ import "./chunk-4LUMV4YO.mjs";
29
29
  import "./chunk-YQFVRDNC.mjs";
30
30
  import "./chunk-YQ3D5IQV.mjs";
31
31
  import "./chunk-CPMIEVKK.mjs";
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "1.3.14-fix-handle-execute-agent-error.0",
12
+ "version": "1.3.14",
13
13
  "sideEffects": [
14
14
  "**/*.css"
15
15
  ],
@@ -40,9 +40,9 @@
40
40
  "ts-jest": "^29.1.1",
41
41
  "tsup": "^6.7.0",
42
42
  "typescript": "^5.2.3",
43
- "eslint-config-custom": "1.3.14-fix-handle-execute-agent-error.0",
44
- "tailwind-config": "1.3.14-fix-handle-execute-agent-error.0",
45
- "tsconfig": "1.3.14-fix-handle-execute-agent-error.0"
43
+ "eslint-config-custom": "1.3.14",
44
+ "tailwind-config": "1.3.14",
45
+ "tsconfig": "1.3.14"
46
46
  },
47
47
  "dependencies": {
48
48
  "@headlessui/react": "^2.1.3",
@@ -50,9 +50,9 @@
50
50
  "react-syntax-highlighter": "^15.5.0",
51
51
  "remark-gfm": "^3.0.1",
52
52
  "remark-math": "^5.1.1",
53
- "@copilotkit/react-core": "1.3.14-fix-handle-execute-agent-error.0",
54
- "@copilotkit/runtime-client-gql": "1.3.14-fix-handle-execute-agent-error.0",
55
- "@copilotkit/shared": "1.3.14-fix-handle-execute-agent-error.0"
53
+ "@copilotkit/react-core": "1.3.14",
54
+ "@copilotkit/runtime-client-gql": "1.3.14",
55
+ "@copilotkit/shared": "1.3.14"
56
56
  },
57
57
  "keywords": [
58
58
  "copilotkit",
@@ -79,7 +79,12 @@ export const Input = ({ inProgress, onSend, isVisible = false }: InputProps) =>
79
79
  {context.icons.pushToTalkIcon}
80
80
  </button>
81
81
  )}
82
- <button disabled={sendDisabled} onClick={send}>
82
+ <button
83
+ disabled={sendDisabled}
84
+ onClick={send}
85
+ data-copilotkit-in-progress={!!inProgress}
86
+ data-testid={inProgress ? "copilot-chat-request-in-progress" : undefined}
87
+ >
83
88
  {sendIcon}
84
89
  </button>
85
90
  </div>
@@ -55,11 +55,15 @@ export const reloadSuggestions = async (
55
55
  const result = await extract({
56
56
  context,
57
57
  instructions:
58
- "Suggest what the user could say next. Provide clear, highly relevant suggestions. Do not literally suggest function calls. " +
58
+ "Suggest what the user could say next. Provide clear, highly relevant suggestions. Do not literally suggest function calls. ",
59
+ data:
59
60
  config.instructions +
60
61
  "\n\n" +
61
- numOfSuggestionsInstructions,
62
- data: "Available tools: " + tools + "\n\n",
62
+ numOfSuggestionsInstructions +
63
+ "\n\n" +
64
+ "Available tools: " +
65
+ tools +
66
+ "\n\n",
63
67
  requestType: CopilotRequestType.Task,
64
68
  parameters: [
65
69
  {
@@ -56,7 +56,11 @@ export function RenderActionExecutionMessage(props: RenderMessageProps) {
56
56
  );
57
57
  } else {
58
58
  return (
59
- <div key={index} className="copilotKitCustomAssistantMessage">
59
+ <div
60
+ key={index}
61
+ data-message-type="action-render"
62
+ className="copilotKitCustomAssistantMessage"
63
+ >
60
64
  {toRender}
61
65
  </div>
62
66
  );
@@ -9,13 +9,21 @@ export function RenderTextMessage(props: RenderMessageProps) {
9
9
  if (message.isTextMessage()) {
10
10
  if (message.role === "user") {
11
11
  return (
12
- <div key={index} className="copilotKitMessage copilotKitUserMessage">
12
+ <div
13
+ key={index}
14
+ data-message-role="user"
15
+ className="copilotKitMessage copilotKitUserMessage"
16
+ >
13
17
  {message.content}
14
18
  </div>
15
19
  );
16
20
  } else if (message.role == "assistant") {
17
21
  return (
18
- <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>
22
+ <div
23
+ key={index}
24
+ data-message-role="assistant"
25
+ className={`copilotKitMessage copilotKitAssistantMessage`}
26
+ >
19
27
  {isCurrentMessage && inProgress && !message.content ? (
20
28
  icons.spinnerIcon
21
29
  ) : (
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/chat/messages/RenderActionExecutionMessage.tsx"],"sourcesContent":["import { ActionExecutionMessage, MessageStatusCode } from \"@copilotkit/runtime-client-gql\";\nimport { RenderMessageProps } from \"../props\";\nimport { useChatContext } from \"../ChatContext\";\nimport { RenderFunctionStatus, useCopilotContext } from \"@copilotkit/react-core\";\n\nexport function RenderActionExecutionMessage(props: RenderMessageProps) {\n const { message, inProgress, index, isCurrentMessage, actionResult } = props;\n const { chatComponentsCache } = useCopilotContext();\n const { icons } = useChatContext();\n\n if (message.isActionExecutionMessage()) {\n if (chatComponentsCache.current !== null && chatComponentsCache.current.actions[message.name]) {\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 {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 (actionResult !== undefined) {\n status = \"complete\";\n } else if (message.status.code !== MessageStatusCode.Pending) {\n status = \"executing\";\n }\n\n try {\n const toRender = render({\n status: status as any,\n args,\n result: actionResult,\n });\n // No result and complete: stay silent\n if (!toRender && status === \"complete\") {\n return null;\n }\n if (typeof toRender === \"string\") {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {isCurrentMessage && inProgress && icons.spinnerIcon} {toRender}\n </div>\n );\n } else {\n return (\n <div key={index} className=\"copilotKitCustomAssistantMessage\">\n {toRender}\n </div>\n );\n }\n } catch (e) {\n console.error(`Error executing render function for action ${message.name}: ${e}`);\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {isCurrentMessage && inProgress && icons.spinnerIcon}\n <b>❌ Error executing render: {message.name}</b>\n <br />\n {e instanceof Error ? e.message : String(e)}\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 {icons.spinnerIcon}\n </div>\n );\n }\n }\n}\n"],"mappings":";;;;;AAAA,SAAiC,yBAAyB;AAG1D,SAA+B,yBAAyB;AAe5C,SACsB,KADtB;AAbL,SAAS,6BAA6B,OAA2B;AACtE,QAAM,EAAE,SAAS,YAAY,OAAO,kBAAkB,aAAa,IAAI;AACvE,QAAM,EAAE,oBAAoB,IAAI,kBAAkB;AAClD,QAAM,EAAE,MAAM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CAAC;AAAA,eAJlC,KAKV;AAAA,QAEJ;AAAA,MACF;AAAA,IACF,WAES,CAAC,cAAc,CAAC,kBAAkB;AAEzC,aAAO;AAAA,IACT,OAAO;AAEL,aACE,oBAAC,SAAgB,WAAW,gDACzB,gBAAM,eADC,KAEV;AAAA,IAEJ;AAAA,EACF;AACF;","names":[]}
@@ -1 +0,0 @@
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 >\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 config.instructions +\n \"\\n\\n\" +\n numOfSuggestionsInstructions,\n data: \"Available tools: \" + tools + \"\\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,SASE,KATF;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,MACj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AAY,QAAQ,KAAK;AAE3C,gBAAI,OAAO,mBAAmB,UAAa,KAAK,OAAO,gBAAgB;AACrE;AAAA,YACF;AACA,kBAAM,EAAE,OAAO,QAAQ,IAAI,YAAY,CAAC;AAGxC,kBAAM,UAAU,KAAK,YAAY,SAAS,KAAK,WAAW;AAE1D,2BAAe,KAAK;AAAA,cAClB;AAAA,cACA;AAAA,cACA;AAAA,cACA,WAAW,OAAO;AAAA,YACpB,CAAC;AAAA,UACH;AACA,gCAAsB,CAAC,GAAG,gBAAgB,GAAG,cAAc,CAAC;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":[]}
@@ -1,25 +0,0 @@
1
- import {
2
- Markdown
3
- } from "./chunk-YQ3D5IQV.mjs";
4
- import {
5
- useChatContext
6
- } from "./chunk-CBBFRI3Q.mjs";
7
-
8
- // src/components/chat/messages/RenderTextMessage.tsx
9
- import { jsx } from "react/jsx-runtime";
10
- function RenderTextMessage(props) {
11
- const { message, inProgress, index, isCurrentMessage } = props;
12
- const { icons } = useChatContext();
13
- if (message.isTextMessage()) {
14
- if (message.role === "user") {
15
- return /* @__PURE__ */ jsx("div", { className: "copilotKitMessage copilotKitUserMessage", children: message.content }, index);
16
- } else if (message.role == "assistant") {
17
- return /* @__PURE__ */ jsx("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: isCurrentMessage && inProgress && !message.content ? icons.spinnerIcon : /* @__PURE__ */ jsx(Markdown, { content: message.content }) }, index);
18
- }
19
- }
20
- }
21
-
22
- export {
23
- RenderTextMessage
24
- };
25
- //# sourceMappingURL=chunk-WYMTXCQU.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/chat/messages/RenderTextMessage.tsx"],"sourcesContent":["import { TextMessage } from \"@copilotkit/runtime-client-gql\";\nimport { RenderMessageProps } from \"../props\";\nimport { Markdown } from \"../Markdown\";\nimport { useChatContext } from \"../ChatContext\";\n\nexport function RenderTextMessage(props: RenderMessageProps) {\n const { message, inProgress, index, isCurrentMessage } = props;\n const { icons } = useChatContext();\n if (message.isTextMessage()) {\n if (message.role === \"user\") {\n return (\n <div key={index} className=\"copilotKitMessage copilotKitUserMessage\">\n {message.content}\n </div>\n );\n } else if (message.role == \"assistant\") {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {isCurrentMessage && inProgress && !message.content ? (\n icons.spinnerIcon\n ) : (\n <Markdown content={message.content} />\n )}\n </div>\n );\n }\n }\n}\n"],"mappings":";;;;;;;;AAWQ;AAND,SAAS,kBAAkB,OAA2B;AAC3D,QAAM,EAAE,SAAS,YAAY,OAAO,iBAAiB,IAAI;AACzD,QAAM,EAAE,MAAM,IAAI,eAAe;AACjC,MAAI,QAAQ,cAAc,GAAG;AAC3B,QAAI,QAAQ,SAAS,QAAQ;AAC3B,aACE,oBAAC,SAAgB,WAAU,2CACxB,kBAAQ,WADD,KAEV;AAAA,IAEJ,WAAW,QAAQ,QAAQ,aAAa;AACtC,aACE,oBAAC,SAAgB,WAAW,gDACzB,8BAAoB,cAAc,CAAC,QAAQ,UAC1C,MAAM,cAEN,oBAAC,YAAS,SAAS,QAAQ,SAAS,KAJ9B,KAMV;AAAA,IAEJ;AAAA,EACF;AACF;","names":[]}