@copilotkit/react-core 1.10.0-next.11 → 1.10.0-next.13

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 (114) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/{chunk-ADZDXHVC.mjs → chunk-2GRWTU7W.mjs} +4 -4
  3. package/dist/chunk-3BASANUO.mjs +170 -0
  4. package/dist/chunk-3BASANUO.mjs.map +1 -0
  5. package/dist/{chunk-LVWV62JZ.mjs → chunk-5P46WS5M.mjs} +32 -26
  6. package/dist/chunk-5P46WS5M.mjs.map +1 -0
  7. package/dist/{chunk-OKRZF3DD.mjs → chunk-6ZLPNY7X.mjs} +2 -2
  8. package/dist/{chunk-OKRZF3DD.mjs.map → chunk-6ZLPNY7X.mjs.map} +1 -1
  9. package/dist/{chunk-COEUPDRL.mjs → chunk-BEFEBKKI.mjs} +8 -8
  10. package/dist/{chunk-QGE7U4NV.mjs → chunk-F26O2HTO.mjs} +3 -3
  11. package/dist/chunk-F26O2HTO.mjs.map +1 -0
  12. package/dist/{chunk-DLEXVOQE.mjs → chunk-GEKWHETN.mjs} +4 -4
  13. package/dist/{chunk-L6HQIJ74.mjs → chunk-JY3STRON.mjs} +8 -8
  14. package/dist/{chunk-JJDXTTEN.mjs → chunk-K4HXT453.mjs} +2 -2
  15. package/dist/{chunk-JBLMXZ3O.mjs → chunk-KH27ZS4Y.mjs} +6 -6
  16. package/dist/{chunk-TWYUYC4F.mjs → chunk-MUDXTKXE.mjs} +6 -6
  17. package/dist/{chunk-Q42NJFXR.mjs → chunk-N4VN2B5S.mjs} +5 -5
  18. package/dist/{chunk-2TSNHEIS.mjs → chunk-NTH42BY5.mjs} +5 -5
  19. package/dist/{chunk-X2DNXTME.mjs → chunk-OPRDTF4S.mjs} +4 -4
  20. package/dist/chunk-PIF5KJYI.mjs +103 -0
  21. package/dist/chunk-PIF5KJYI.mjs.map +1 -0
  22. package/dist/chunk-WSXTUD36.mjs +759 -0
  23. package/dist/chunk-WSXTUD36.mjs.map +1 -0
  24. package/dist/{chunk-IHAZJF3V.mjs → chunk-YIBUNEBN.mjs} +2 -2
  25. package/dist/chunk-YIBUNEBN.mjs.map +1 -0
  26. package/dist/components/copilot-provider/copilot-messages.mjs +3 -3
  27. package/dist/components/copilot-provider/copilotkit-props.d.ts +9 -1
  28. package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
  29. package/dist/components/copilot-provider/copilotkit.js +1047 -71
  30. package/dist/components/copilot-provider/copilotkit.js.map +1 -1
  31. package/dist/components/copilot-provider/copilotkit.mjs +11 -8
  32. package/dist/components/copilot-provider/index.js +1047 -71
  33. package/dist/components/copilot-provider/index.js.map +1 -1
  34. package/dist/components/copilot-provider/index.mjs +11 -8
  35. package/dist/components/dev-console/console-trigger.d.ts +8 -0
  36. package/dist/components/dev-console/console-trigger.js +1131 -0
  37. package/dist/components/dev-console/console-trigger.js.map +1 -0
  38. package/dist/components/dev-console/console-trigger.mjs +13 -0
  39. package/dist/components/dev-console/console-trigger.mjs.map +1 -0
  40. package/dist/components/dev-console/developer-console-modal.d.ts +10 -0
  41. package/dist/components/dev-console/developer-console-modal.js +977 -0
  42. package/dist/components/dev-console/developer-console-modal.js.map +1 -0
  43. package/dist/components/dev-console/developer-console-modal.mjs +12 -0
  44. package/dist/components/dev-console/developer-console-modal.mjs.map +1 -0
  45. package/dist/components/dev-console/icons.d.ts +9 -0
  46. package/dist/components/dev-console/icons.js +131 -0
  47. package/dist/components/dev-console/icons.js.map +1 -0
  48. package/dist/components/dev-console/icons.mjs +16 -0
  49. package/dist/components/dev-console/icons.mjs.map +1 -0
  50. package/dist/components/error-boundary/error-boundary.js +1 -1
  51. package/dist/components/error-boundary/error-boundary.js.map +1 -1
  52. package/dist/components/error-boundary/error-boundary.mjs +2 -2
  53. package/dist/components/index.js +1047 -71
  54. package/dist/components/index.js.map +1 -1
  55. package/dist/components/index.mjs +11 -8
  56. package/dist/components/usage-banner.js +1 -1
  57. package/dist/components/usage-banner.js.map +1 -1
  58. package/dist/components/usage-banner.mjs +1 -1
  59. package/dist/context/index.mjs +4 -4
  60. package/dist/hooks/index.js +1 -1
  61. package/dist/hooks/index.js.map +1 -1
  62. package/dist/hooks/index.mjs +32 -29
  63. package/dist/hooks/use-chat.mjs +4 -4
  64. package/dist/hooks/use-coagent-state-render.mjs +2 -2
  65. package/dist/hooks/use-coagent.js.map +1 -1
  66. package/dist/hooks/use-coagent.mjs +16 -13
  67. package/dist/hooks/use-copilot-action.mjs +2 -2
  68. package/dist/hooks/use-copilot-authenticated-action.mjs +3 -3
  69. package/dist/hooks/use-copilot-chat-headless_c.js +1 -1
  70. package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
  71. package/dist/hooks/use-copilot-chat-headless_c.mjs +16 -13
  72. package/dist/hooks/use-copilot-chat.d.ts +42 -3
  73. package/dist/hooks/use-copilot-chat.js.map +1 -1
  74. package/dist/hooks/use-copilot-chat.mjs +16 -13
  75. package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
  76. package/dist/hooks/use-copilot-chat_internal.mjs +15 -12
  77. package/dist/hooks/use-langgraph-interrupt-render.mjs +1 -1
  78. package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
  79. package/dist/hooks/use-langgraph-interrupt.mjs +16 -13
  80. package/dist/index.js +1145 -178
  81. package/dist/index.js.map +1 -1
  82. package/dist/index.mjs +36 -33
  83. package/dist/lib/copilot-task.js.map +1 -1
  84. package/dist/lib/copilot-task.mjs +13 -10
  85. package/dist/lib/index.js.map +1 -1
  86. package/dist/lib/index.mjs +13 -10
  87. package/dist/utils/extract.js.map +1 -1
  88. package/dist/utils/extract.mjs +11 -8
  89. package/dist/utils/index.js.map +1 -1
  90. package/dist/utils/index.mjs +11 -8
  91. package/dist/utils/suggestions.js.map +1 -1
  92. package/dist/utils/suggestions.mjs +11 -8
  93. package/package.json +3 -3
  94. package/src/components/copilot-provider/copilotkit-props.tsx +10 -1
  95. package/src/components/copilot-provider/copilotkit.tsx +25 -16
  96. package/src/components/dev-console/console-trigger.tsx +190 -0
  97. package/src/components/dev-console/developer-console-modal.tsx +866 -0
  98. package/src/components/dev-console/icons.tsx +101 -0
  99. package/src/components/usage-banner.tsx +1 -1
  100. package/src/hooks/use-copilot-chat-headless_c.ts +79 -9
  101. package/src/hooks/use-copilot-chat.ts +42 -3
  102. package/dist/chunk-IHAZJF3V.mjs.map +0 -1
  103. package/dist/chunk-LVWV62JZ.mjs.map +0 -1
  104. package/dist/chunk-QGE7U4NV.mjs.map +0 -1
  105. /package/dist/{chunk-ADZDXHVC.mjs.map → chunk-2GRWTU7W.mjs.map} +0 -0
  106. /package/dist/{chunk-COEUPDRL.mjs.map → chunk-BEFEBKKI.mjs.map} +0 -0
  107. /package/dist/{chunk-DLEXVOQE.mjs.map → chunk-GEKWHETN.mjs.map} +0 -0
  108. /package/dist/{chunk-L6HQIJ74.mjs.map → chunk-JY3STRON.mjs.map} +0 -0
  109. /package/dist/{chunk-JJDXTTEN.mjs.map → chunk-K4HXT453.mjs.map} +0 -0
  110. /package/dist/{chunk-JBLMXZ3O.mjs.map → chunk-KH27ZS4Y.mjs.map} +0 -0
  111. /package/dist/{chunk-TWYUYC4F.mjs.map → chunk-MUDXTKXE.mjs.map} +0 -0
  112. /package/dist/{chunk-Q42NJFXR.mjs.map → chunk-N4VN2B5S.mjs.map} +0 -0
  113. /package/dist/{chunk-2TSNHEIS.mjs.map → chunk-NTH42BY5.mjs.map} +0 -0
  114. /package/dist/{chunk-X2DNXTME.mjs.map → chunk-OPRDTF4S.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # ui
2
2
 
3
+ ## 1.10.0-next.13
4
+
5
+ ### Patch Changes
6
+
7
+ - @copilotkit/runtime-client-gql@1.10.0-next.13
8
+ - @copilotkit/shared@1.10.0-next.13
9
+
10
+ ## 1.10.0-next.12
11
+
12
+ ### Patch Changes
13
+
14
+ - b64555d: - feat: adds dev console
15
+ - @copilotkit/runtime-client-gql@1.10.0-next.12
16
+ - @copilotkit/shared@1.10.0-next.12
17
+
3
18
  ## 1.10.0-next.11
4
19
 
5
20
  ### Patch Changes
@@ -1,9 +1,9 @@
1
- import {
2
- defaultCopilotContextCategories
3
- } from "./chunk-LVWV62JZ.mjs";
4
1
  import {
5
2
  processActionsForRuntimeRequest
6
3
  } from "./chunk-4CEQJ2X6.mjs";
4
+ import {
5
+ defaultCopilotContextCategories
6
+ } from "./chunk-5P46WS5M.mjs";
7
7
  import {
8
8
  __async,
9
9
  __spreadValues
@@ -117,4 +117,4 @@ ${instructions}
117
117
  export {
118
118
  CopilotTask
119
119
  };
120
- //# sourceMappingURL=chunk-ADZDXHVC.mjs.map
120
+ //# sourceMappingURL=chunk-2GRWTU7W.mjs.map
@@ -0,0 +1,170 @@
1
+ import {
2
+ DeveloperConsoleModal
3
+ } from "./chunk-WSXTUD36.mjs";
4
+ import {
5
+ CopilotKitIcon
6
+ } from "./chunk-PIF5KJYI.mjs";
7
+ import {
8
+ useCopilotContext
9
+ } from "./chunk-TEMLWRRT.mjs";
10
+
11
+ // src/components/dev-console/console-trigger.tsx
12
+ import { useState, useEffect, useRef } from "react";
13
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
+ function ConsoleTrigger({ position = "bottom-right" }) {
15
+ const context = useCopilotContext();
16
+ const hasApiKey = Boolean(context.copilotApiConfig.publicApiKey);
17
+ const [isModalOpen, setIsModalOpen] = useState(false);
18
+ const [isHovered, setIsHovered] = useState(false);
19
+ const [isDragging, setIsDragging] = useState(false);
20
+ const [buttonPosition, setButtonPosition] = useState(null);
21
+ const [mounted, setMounted] = useState(false);
22
+ const dragRef = useRef(null);
23
+ const buttonRef = useRef(null);
24
+ useEffect(() => {
25
+ setMounted(true);
26
+ if (typeof window !== "undefined" && !buttonPosition) {
27
+ const buttonSize = 60;
28
+ const margin = 24;
29
+ const initialPosition = {
30
+ x: margin,
31
+ y: window.innerHeight - buttonSize - margin
32
+ };
33
+ setButtonPosition(initialPosition);
34
+ }
35
+ }, [position]);
36
+ const handleMouseDown = (e) => {
37
+ e.preventDefault();
38
+ if (!buttonPosition)
39
+ return;
40
+ dragRef.current = {
41
+ startX: e.clientX,
42
+ startY: e.clientY,
43
+ buttonX: buttonPosition.x,
44
+ buttonY: buttonPosition.y
45
+ };
46
+ setIsDragging(true);
47
+ };
48
+ useEffect(() => {
49
+ if (!isDragging)
50
+ return;
51
+ const handleMouseMove = (e) => {
52
+ e.preventDefault();
53
+ e.stopPropagation();
54
+ if (!dragRef.current)
55
+ return;
56
+ const deltaX = e.clientX - dragRef.current.startX;
57
+ const deltaY = e.clientY - dragRef.current.startY;
58
+ let newX = dragRef.current.buttonX + deltaX;
59
+ let newY = dragRef.current.buttonY + deltaY;
60
+ newX = Math.max(0, Math.min(newX, window.innerWidth - 60));
61
+ newY = Math.max(0, Math.min(newY, window.innerHeight - 60));
62
+ setButtonPosition({ x: newX, y: newY });
63
+ };
64
+ const handleMouseUp = (e) => {
65
+ e.preventDefault();
66
+ e.stopPropagation();
67
+ setIsDragging(false);
68
+ dragRef.current = null;
69
+ };
70
+ document.addEventListener("mousemove", handleMouseMove, { capture: true, passive: false });
71
+ document.addEventListener("mouseup", handleMouseUp, { capture: true, passive: false });
72
+ return () => {
73
+ document.removeEventListener("mousemove", handleMouseMove, { capture: true });
74
+ document.removeEventListener("mouseup", handleMouseUp, { capture: true });
75
+ };
76
+ }, [isDragging]);
77
+ if (!mounted || !buttonPosition) {
78
+ return null;
79
+ }
80
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
81
+ /* @__PURE__ */ jsxs(
82
+ "button",
83
+ {
84
+ ref: buttonRef,
85
+ onClick: () => {
86
+ if (!isDragging) {
87
+ setIsModalOpen(true);
88
+ }
89
+ },
90
+ onMouseDown: handleMouseDown,
91
+ onMouseEnter: () => setIsHovered(true),
92
+ onMouseLeave: () => setIsHovered(false),
93
+ style: {
94
+ position: "fixed",
95
+ left: `${buttonPosition.x}px`,
96
+ top: `${buttonPosition.y}px`,
97
+ zIndex: 2147483647,
98
+ width: "60px",
99
+ height: "60px",
100
+ background: isDragging ? "#000000" : isHovered ? "#111111" : "#000000",
101
+ color: "white",
102
+ borderRadius: "50%",
103
+ boxShadow: isDragging ? "0 8px 32px rgba(0, 0, 0, 0.6), 0 4px 16px rgba(0, 0, 0, 0.4)" : isHovered ? "0 12px 40px rgba(0, 0, 0, 0.7), 0 6px 20px rgba(0, 0, 0, 0.5)" : "0 6px 20px rgba(0, 0, 0, 0.5), 0 3px 10px rgba(0, 0, 0, 0.3)",
104
+ transition: isDragging ? "none" : "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
105
+ display: "flex",
106
+ alignItems: "center",
107
+ justifyContent: "center",
108
+ border: "none",
109
+ cursor: isDragging ? "grabbing" : "grab",
110
+ opacity: 1,
111
+ userSelect: "none",
112
+ transform: isDragging ? "scale(1.05)" : isHovered ? "scale(1.1)" : "scale(1)",
113
+ backdropFilter: "blur(10px)",
114
+ pointerEvents: "auto",
115
+ isolation: "isolate"
116
+ },
117
+ title: hasApiKey ? "Open Developer Console (Drag to move)" : "Developer Console (API Key Required, Drag to move)",
118
+ children: [
119
+ /* @__PURE__ */ jsx(
120
+ "div",
121
+ {
122
+ style: {
123
+ width: "28px",
124
+ height: "28px",
125
+ display: "flex",
126
+ alignItems: "center",
127
+ justifyContent: "center",
128
+ filter: "drop-shadow(0 2px 4px rgba(0,0,0,0.2))"
129
+ },
130
+ children: /* @__PURE__ */ jsx(CopilotKitIcon, {})
131
+ }
132
+ ),
133
+ !hasApiKey && /* @__PURE__ */ jsx(
134
+ "div",
135
+ {
136
+ style: {
137
+ position: "absolute",
138
+ top: "-2px",
139
+ right: "-2px",
140
+ width: "18px",
141
+ height: "18px",
142
+ background: "linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%)",
143
+ borderRadius: "50%",
144
+ display: "flex",
145
+ alignItems: "center",
146
+ justifyContent: "center",
147
+ boxShadow: "0 2px 8px rgba(255, 107, 107, 0.4)",
148
+ border: "2px solid white"
149
+ },
150
+ children: /* @__PURE__ */ jsx("span", { style: { fontSize: "10px", color: "white", fontWeight: "bold" }, children: "!" })
151
+ }
152
+ )
153
+ ]
154
+ }
155
+ ),
156
+ /* @__PURE__ */ jsx(
157
+ DeveloperConsoleModal,
158
+ {
159
+ isOpen: isModalOpen,
160
+ onClose: () => setIsModalOpen(false),
161
+ hasApiKey
162
+ }
163
+ )
164
+ ] });
165
+ }
166
+
167
+ export {
168
+ ConsoleTrigger
169
+ };
170
+ //# sourceMappingURL=chunk-3BASANUO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/dev-console/console-trigger.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useState, useEffect, useRef } from \"react\";\nimport { useCopilotContext } from \"../../context/copilot-context\";\nimport { CopilotKitIcon } from \"./icons\";\nimport { DeveloperConsoleModal } from \"./developer-console-modal\";\n\ninterface ConsoleTriggerProps {\n position?: \"bottom-left\" | \"bottom-right\";\n}\n\nexport function ConsoleTrigger({ position = \"bottom-right\" }: ConsoleTriggerProps) {\n const context = useCopilotContext();\n const hasApiKey = Boolean(context.copilotApiConfig.publicApiKey);\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n const [isDragging, setIsDragging] = useState(false);\n const [buttonPosition, setButtonPosition] = useState<{ x: number; y: number } | null>(null);\n const [mounted, setMounted] = useState(false);\n\n const dragRef = useRef<{\n startX: number;\n startY: number;\n buttonX: number;\n buttonY: number;\n } | null>(null);\n const buttonRef = useRef<HTMLButtonElement>(null);\n\n // Initialize on client side only\n useEffect(() => {\n setMounted(true);\n if (typeof window !== \"undefined\" && !buttonPosition) {\n const buttonSize = 60;\n const margin = 24;\n\n const initialPosition = {\n x: margin,\n y: window.innerHeight - buttonSize - margin,\n };\n\n setButtonPosition(initialPosition);\n }\n }, [position]);\n\n const handleMouseDown = (e: React.MouseEvent) => {\n e.preventDefault();\n if (!buttonPosition) return;\n\n dragRef.current = {\n startX: e.clientX,\n startY: e.clientY,\n buttonX: buttonPosition.x,\n buttonY: buttonPosition.y,\n };\n setIsDragging(true);\n };\n\n useEffect(() => {\n if (!isDragging) return;\n\n const handleMouseMove = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (!dragRef.current) return;\n\n const deltaX = e.clientX - dragRef.current.startX;\n const deltaY = e.clientY - dragRef.current.startY;\n\n // Calculate new position\n let newX = dragRef.current.buttonX + deltaX;\n let newY = dragRef.current.buttonY + deltaY;\n\n // Keep button within viewport bounds\n newX = Math.max(0, Math.min(newX, window.innerWidth - 60));\n newY = Math.max(0, Math.min(newY, window.innerHeight - 60));\n\n setButtonPosition({ x: newX, y: newY });\n };\n\n const handleMouseUp = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(false);\n dragRef.current = null;\n };\n\n // Use capture phase to intercept events before they reach other handlers\n document.addEventListener(\"mousemove\", handleMouseMove, { capture: true, passive: false });\n document.addEventListener(\"mouseup\", handleMouseUp, { capture: true, passive: false });\n\n return () => {\n document.removeEventListener(\"mousemove\", handleMouseMove, { capture: true });\n document.removeEventListener(\"mouseup\", handleMouseUp, { capture: true });\n };\n }, [isDragging]);\n\n // Don't render until mounted and position is initialized\n if (!mounted || !buttonPosition) {\n return null;\n }\n\n return (\n <>\n <button\n ref={buttonRef}\n onClick={() => {\n if (!isDragging) {\n setIsModalOpen(true);\n }\n }}\n onMouseDown={handleMouseDown}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{\n position: \"fixed\",\n left: `${buttonPosition.x}px`,\n top: `${buttonPosition.y}px`,\n zIndex: 2147483647,\n width: \"60px\",\n height: \"60px\",\n background: isDragging ? \"#000000\" : isHovered ? \"#111111\" : \"#000000\",\n color: \"white\",\n borderRadius: \"50%\",\n boxShadow: isDragging\n ? \"0 8px 32px rgba(0, 0, 0, 0.6), 0 4px 16px rgba(0, 0, 0, 0.4)\"\n : isHovered\n ? \"0 12px 40px rgba(0, 0, 0, 0.7), 0 6px 20px rgba(0, 0, 0, 0.5)\"\n : \"0 6px 20px rgba(0, 0, 0, 0.5), 0 3px 10px rgba(0, 0, 0, 0.3)\",\n transition: isDragging ? \"none\" : \"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n border: \"none\",\n cursor: isDragging ? \"grabbing\" : \"grab\",\n opacity: 1,\n userSelect: \"none\",\n transform: isDragging ? \"scale(1.05)\" : isHovered ? \"scale(1.1)\" : \"scale(1)\",\n backdropFilter: \"blur(10px)\",\n pointerEvents: \"auto\",\n isolation: \"isolate\",\n }}\n title={\n hasApiKey\n ? \"Open Developer Console (Drag to move)\"\n : \"Developer Console (API Key Required, Drag to move)\"\n }\n >\n <div\n style={{\n width: \"28px\",\n height: \"28px\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n filter: \"drop-shadow(0 2px 4px rgba(0,0,0,0.2))\",\n }}\n >\n <CopilotKitIcon />\n </div>\n {!hasApiKey && (\n <div\n style={{\n position: \"absolute\",\n top: \"-2px\",\n right: \"-2px\",\n width: \"18px\",\n height: \"18px\",\n background: \"linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%)\",\n borderRadius: \"50%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n boxShadow: \"0 2px 8px rgba(255, 107, 107, 0.4)\",\n border: \"2px solid white\",\n }}\n >\n <span style={{ fontSize: \"10px\", color: \"white\", fontWeight: \"bold\" }}>!</span>\n </div>\n )}\n </button>\n\n <DeveloperConsoleModal\n isOpen={isModalOpen}\n onClose={() => setIsModalOpen(false)}\n hasApiKey={hasApiKey}\n />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;AAEA,SAAgB,UAAU,WAAW,cAAc;AAqG/C,mBAuDM,KAtDJ,YADF;AA5FG,SAAS,eAAe,EAAE,WAAW,eAAe,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,SAAS;AAAA,UACT,YAAY;AAAA,UACZ,gBAAgB;AAAA,UAChB,QAAQ;AAAA,UACR,QAAQ,aAAa,aAAa;AAAA,UAClC,SAAS;AAAA,UACT,YAAY;AAAA,UACZ,WAAW,aAAa,gBAAgB,YAAY,eAAe;AAAA,UACnE,gBAAgB;AAAA,UAChB,eAAe;AAAA,UACf,WAAW;AAAA,QACb;AAAA,QACA,OACE,YACI,0CACA;AAAA,QAGN;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,OAAO;AAAA,gBACL,OAAO;AAAA,gBACP,QAAQ;AAAA,gBACR,SAAS;AAAA,gBACT,YAAY;AAAA,gBACZ,gBAAgB;AAAA,gBAChB,QAAQ;AAAA,cACV;AAAA,cAEA,8BAAC,kBAAe;AAAA;AAAA,UAClB;AAAA,UACC,CAAC,aACA;AAAA,YAAC;AAAA;AAAA,cACC,OAAO;AAAA,gBACL,UAAU;AAAA,gBACV,KAAK;AAAA,gBACL,OAAO;AAAA,gBACP,OAAO;AAAA,gBACP,QAAQ;AAAA,gBACR,YAAY;AAAA,gBACZ,cAAc;AAAA,gBACd,SAAS;AAAA,gBACT,YAAY;AAAA,gBACZ,gBAAgB;AAAA,gBAChB,WAAW;AAAA,gBACX,QAAQ;AAAA,cACV;AAAA,cAEA,8BAAC,UAAK,OAAO,EAAE,UAAU,QAAQ,OAAO,SAAS,YAAY,OAAO,GAAG,eAAC;AAAA;AAAA,UAC1E;AAAA;AAAA;AAAA,IAEJ;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,SAAS,MAAM,eAAe,KAAK;AAAA,QACnC;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
@@ -1,35 +1,35 @@
1
+ import {
2
+ CopilotErrorBoundary
3
+ } from "./chunk-N4VN2B5S.mjs";
1
4
  import {
2
5
  CopilotMessages,
3
6
  MessagesTapProvider
4
- } from "./chunk-TWYUYC4F.mjs";
7
+ } from "./chunk-MUDXTKXE.mjs";
5
8
  import {
6
- CopilotErrorBoundary
7
- } from "./chunk-Q42NJFXR.mjs";
8
- import {
9
- StatusChecker
10
- } from "./chunk-PMAFHQ7P.mjs";
9
+ ConsoleTrigger
10
+ } from "./chunk-3BASANUO.mjs";
11
11
  import {
12
12
  use_flat_category_store_default
13
13
  } from "./chunk-5FHSUKQL.mjs";
14
14
  import {
15
15
  use_tree_default
16
16
  } from "./chunk-RKTVJRK7.mjs";
17
- import {
18
- UsageBanner,
19
- getErrorActions
20
- } from "./chunk-OKRZF3DD.mjs";
21
17
  import {
22
18
  useCopilotRuntimeClient
23
19
  } from "./chunk-FAUNHSQU.mjs";
24
20
  import {
25
21
  shouldShowDevConsole
26
22
  } from "./chunk-ICIK2BSB.mjs";
27
- import {
28
- CopilotContext
29
- } from "./chunk-TEMLWRRT.mjs";
30
23
  import {
31
24
  ToastProvider
32
25
  } from "./chunk-EFL5OBKN.mjs";
26
+ import {
27
+ UsageBanner,
28
+ getErrorActions
29
+ } from "./chunk-6ZLPNY7X.mjs";
30
+ import {
31
+ CopilotContext
32
+ } from "./chunk-TEMLWRRT.mjs";
33
33
  import {
34
34
  __async,
35
35
  __objRest,
@@ -198,11 +198,13 @@ import { jsx, jsxs } from "react/jsx-runtime";
198
198
  function CopilotKit(_a) {
199
199
  var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
200
200
  const enabled = shouldShowDevConsole(props.showDevConsole);
201
- return /* @__PURE__ */ jsx(ToastProvider, { enabled, children: /* @__PURE__ */ jsx(CopilotErrorBoundary, { publicApiKey: props.publicApiKey, showUsageBanner: enabled, children: /* @__PURE__ */ jsx(CopilotKitInternal, __spreadProps(__spreadValues({}, props), { children })) }) });
201
+ const publicApiKey = props.publicApiKey || props.publicLicenseKey;
202
+ return /* @__PURE__ */ jsx(ToastProvider, { enabled, children: /* @__PURE__ */ jsx(CopilotErrorBoundary, { publicApiKey, showUsageBanner: enabled, children: /* @__PURE__ */ jsx(CopilotKitInternal, __spreadProps(__spreadValues({}, props), { children })) }) });
202
203
  }
203
204
  function CopilotKitInternal(cpkProps) {
204
205
  const _a = cpkProps, { children } = _a, props = __objRest(_a, ["children"]);
205
206
  validateProps(cpkProps);
207
+ const publicApiKey = props.publicLicenseKey || props.publicApiKey;
206
208
  const chatApiEndpoint = props.runtimeUrl || COPILOT_CLOUD_CHAT_URL;
207
209
  const [actions, setActions] = useState({});
208
210
  const [coAgentStateRenders, setCoAgentStateRenders] = useState({});
@@ -221,8 +223,6 @@ function CopilotKitInternal(cpkProps) {
221
223
  removeElement: removeDocument,
222
224
  allElements: allDocuments
223
225
  } = use_flat_category_store_default();
224
- const statusChecker = useMemo(() => new StatusChecker(), []);
225
- const [usageBannerStatus, setUsageBannerStatus] = useState(null);
226
226
  const setAction = useCallback((id, action) => {
227
227
  setActions((prevPoints) => {
228
228
  return __spreadProps(__spreadValues({}, prevPoints), {
@@ -306,7 +306,7 @@ ${nonDocumentStrings}`;
306
306
  const copilotApiConfig = useMemo(() => {
307
307
  var _a2, _b;
308
308
  let cloud = void 0;
309
- if (props.publicApiKey) {
309
+ if (publicApiKey) {
310
310
  cloud = {
311
311
  guardrails: {
312
312
  input: {
@@ -320,7 +320,7 @@ ${nonDocumentStrings}`;
320
320
  };
321
321
  }
322
322
  return __spreadProps(__spreadValues({
323
- publicApiKey: props.publicApiKey
323
+ publicApiKey
324
324
  }, cloud ? { cloud } : {}), {
325
325
  chatApiEndpoint,
326
326
  headers: props.headers || {},
@@ -330,7 +330,7 @@ ${nonDocumentStrings}`;
330
330
  credentials: props.credentials
331
331
  });
332
332
  }, [
333
- props.publicApiKey,
333
+ publicApiKey,
334
334
  props.headers,
335
335
  props.properties,
336
336
  props.transcribeAudioUrl,
@@ -355,7 +355,7 @@ ${nonDocumentStrings}`;
355
355
  }, [copilotApiConfig.headers, copilotApiConfig.publicApiKey, authStates]);
356
356
  const runtimeClient = useCopilotRuntimeClient({
357
357
  url: copilotApiConfig.chatApiEndpoint,
358
- publicApiKey: copilotApiConfig.publicApiKey,
358
+ publicApiKey,
359
359
  headers,
360
360
  credentials: copilotApiConfig.credentials,
361
361
  showDevConsole: shouldShowDevConsole(props.showDevConsole),
@@ -550,7 +550,10 @@ ${nonDocumentStrings}`;
550
550
  setBannerError
551
551
  },
552
552
  children: [
553
- /* @__PURE__ */ jsx(MessagesTapProvider, { children: /* @__PURE__ */ jsx(CopilotMessages, { children: memoizedChildren }) }),
553
+ /* @__PURE__ */ jsx(MessagesTapProvider, { children: /* @__PURE__ */ jsxs(CopilotMessages, { children: [
554
+ memoizedChildren,
555
+ showDevConsole && /* @__PURE__ */ jsx(ConsoleTrigger, {})
556
+ ] }) }),
554
557
  bannerError && showDevConsole && /* @__PURE__ */ jsx(
555
558
  UsageBanner,
556
559
  {
@@ -595,12 +598,15 @@ function formatFeatureName(featureName) {
595
598
  }
596
599
  function validateProps(props) {
597
600
  const cloudFeatures = Object.keys(props).filter((key) => key.endsWith("_c"));
598
- if (!props.runtimeUrl && !props.publicApiKey) {
599
- throw new ConfigurationError("Missing required prop: 'runtimeUrl' or 'publicApiKey'");
601
+ const hasApiKey = props.publicApiKey || props.publicLicenseKey;
602
+ if (!props.runtimeUrl && !hasApiKey) {
603
+ throw new ConfigurationError(
604
+ "Missing required prop: 'runtimeUrl' or 'publicApiKey' or 'publicLicenseKey'"
605
+ );
600
606
  }
601
- if (cloudFeatures.length > 0 && !props.publicApiKey) {
607
+ if (cloudFeatures.length > 0 && !hasApiKey) {
602
608
  throw new MissingPublicApiKeyError(
603
- `Missing required prop: 'publicApiKey' to use cloud features: ${cloudFeatures.map(formatFeatureName).join(", ")}`
609
+ `Missing required prop: 'publicApiKey' or 'publicLicenseKey' to use cloud features: ${cloudFeatures.map(formatFeatureName).join(", ")}`
604
610
  );
605
611
  }
606
612
  }
@@ -747,4 +753,4 @@ export {
747
753
  CopilotKitInternal,
748
754
  defaultCopilotContextCategories
749
755
  };
750
- //# sourceMappingURL=chunk-LVWV62JZ.mjs.map
756
+ //# sourceMappingURL=chunk-5P46WS5M.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/extract.ts","../src/components/copilot-provider/copilotkit.tsx","../src/utils/suggestions.ts"],"sourcesContent":["import {\n Action,\n COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,\n MappedParameterTypes,\n Parameter,\n actionParametersToJsonSchema,\n} from \"@copilotkit/shared\";\nimport {\n ActionExecutionMessage,\n Message,\n Role,\n TextMessage,\n convertGqlOutputToMessages,\n CopilotRequestType,\n ForwardedParametersInput,\n} from \"@copilotkit/runtime-client-gql\";\nimport { CopilotContextParams, CopilotMessagesContextParams } from \"../context\";\nimport { defaultCopilotContextCategories } from \"../components\";\nimport { CopilotRuntimeClient } from \"@copilotkit/runtime-client-gql\";\nimport {\n convertMessagesToGqlInput,\n filterAgentStateMessages,\n} from \"@copilotkit/runtime-client-gql\";\n\ninterface InitialState<T extends Parameter[] | [] = []> {\n status: \"initial\";\n args: Partial<MappedParameterTypes<T>>;\n}\n\ninterface InProgressState<T extends Parameter[] | [] = []> {\n status: \"inProgress\";\n args: Partial<MappedParameterTypes<T>>;\n}\n\ninterface CompleteState<T extends Parameter[] | [] = []> {\n status: \"complete\";\n args: MappedParameterTypes<T>;\n}\n\ntype StreamHandlerArgs<T extends Parameter[] | [] = []> =\n | InitialState<T>\n | InProgressState<T>\n | CompleteState<T>;\n\ninterface ExtractOptions<T extends Parameter[]> {\n context: CopilotContextParams & CopilotMessagesContextParams;\n instructions: string;\n parameters: T;\n include?: IncludeOptions;\n data?: any;\n abortSignal?: AbortSignal;\n stream?: (args: StreamHandlerArgs<T>) => void;\n requestType?: CopilotRequestType;\n forwardedParameters?: ForwardedParametersInput;\n}\n\ninterface IncludeOptions {\n readable?: boolean;\n messages?: boolean;\n}\n\nexport async function extract<const T extends Parameter[]>({\n context,\n instructions,\n parameters,\n include,\n data,\n abortSignal,\n stream,\n requestType = CopilotRequestType.Task,\n forwardedParameters,\n}: ExtractOptions<T>): Promise<MappedParameterTypes<T>> {\n const { messages } = context;\n\n const action: Action<any> = {\n name: \"extract\",\n description: instructions,\n parameters,\n handler: (args: any) => {},\n };\n\n const includeReadable = include?.readable ?? false;\n const includeMessages = include?.messages ?? false;\n\n let contextString = \"\";\n\n if (data) {\n contextString = (typeof data === \"string\" ? data : JSON.stringify(data)) + \"\\n\\n\";\n }\n\n if (includeReadable) {\n contextString += context.getContextString([], defaultCopilotContextCategories);\n }\n\n const systemMessage: Message = new TextMessage({\n content: makeSystemMessage(contextString, instructions),\n role: Role.System,\n });\n\n const instructionsMessage: Message = new TextMessage({\n content: makeInstructionsMessage(instructions),\n role: Role.User,\n });\n\n const response = context.runtimeClient.asStream(\n context.runtimeClient.generateCopilotResponse({\n data: {\n frontend: {\n actions: [\n {\n name: action.name,\n description: action.description || \"\",\n jsonSchema: JSON.stringify(actionParametersToJsonSchema(action.parameters || [])),\n },\n ],\n url: window.location.href,\n },\n\n messages: convertMessagesToGqlInput(\n includeMessages\n ? [systemMessage, instructionsMessage, ...filterAgentStateMessages(messages)]\n : [systemMessage, instructionsMessage],\n ),\n metadata: {\n requestType: requestType,\n },\n forwardedParameters: {\n ...(forwardedParameters ?? {}),\n toolChoice: \"function\",\n toolChoiceFunctionName: action.name,\n },\n },\n properties: context.copilotApiConfig.properties,\n signal: abortSignal,\n }),\n );\n\n const reader = response.getReader();\n\n let isInitial = true;\n\n let actionExecutionMessage: ActionExecutionMessage | undefined = undefined;\n\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) {\n break;\n }\n\n if (abortSignal?.aborted) {\n throw new Error(\"Aborted\");\n }\n\n actionExecutionMessage = convertGqlOutputToMessages(\n value.generateCopilotResponse.messages,\n ).find((msg) => msg.isActionExecutionMessage()) as ActionExecutionMessage | undefined;\n\n if (!actionExecutionMessage) {\n continue;\n }\n\n stream?.({\n status: isInitial ? \"initial\" : \"inProgress\",\n args: actionExecutionMessage.arguments as Partial<MappedParameterTypes<T>>,\n });\n\n isInitial = false;\n }\n\n if (!actionExecutionMessage) {\n throw new Error(\"extract() failed: No function call occurred\");\n }\n\n stream?.({\n status: \"complete\",\n args: actionExecutionMessage.arguments as MappedParameterTypes<T>,\n });\n\n return actionExecutionMessage.arguments as MappedParameterTypes<T>;\n}\n\n// We need to put this in a user message since some LLMs need\n// at least one user message to function\nfunction makeInstructionsMessage(instructions: string): string {\n return `\nThe user has given you the following task to complete:\n\n\\`\\`\\`\n${instructions}\n\\`\\`\\`\n\nAny additional messages provided are for providing context only and should not be used to ask questions or engage in conversation.\n`;\n}\n\nfunction makeSystemMessage(contextString: string, instructions: string): string {\n return `\nPlease act as an efficient, competent, conscientious, and industrious professional assistant.\n\nHelp the user achieve their goals, and you do so in a way that is as efficient as possible, without unnecessary fluff, but also without sacrificing professionalism.\nAlways be polite and respectful, and prefer brevity over verbosity.\n\nThe user has provided you with the following context:\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThey have also provided you with a function called extract you MUST call to initiate actions on their behalf.\n\nPlease assist them as best you can.\n\nThis is not a conversation, so please do not ask questions. Just call the function without saying anything else.\n`;\n}\n","/**\n * This component will typically wrap your entire application (or a sub-tree of your application where you want to have a copilot). It provides the copilot context to all other components and hooks.\n *\n * ## Example\n *\n * You can find more information about self-hosting CopilotKit [here](/guides/self-hosting).\n *\n * ```tsx\n * import { CopilotKit } from \"@copilotkit/react-core\";\n *\n * <CopilotKit runtimeUrl=\"<your-runtime-url>\">\n * // ... your app ...\n * </CopilotKit>\n * ```\n */\n\nimport { useCallback, useEffect, useMemo, useRef, useState, SetStateAction } from \"react\";\nimport {\n CopilotContext,\n CopilotApiConfig,\n ChatComponentsCache,\n AgentSession,\n AuthState,\n} from \"../../context/copilot-context\";\nimport useTree from \"../../hooks/use-tree\";\nimport { CopilotChatSuggestionConfiguration, DocumentPointer } from \"../../types\";\nimport { flushSync } from \"react-dom\";\nimport {\n COPILOT_CLOUD_CHAT_URL,\n CopilotCloudConfig,\n FunctionCallHandler,\n COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,\n randomUUID,\n ConfigurationError,\n MissingPublicApiKeyError,\n CopilotKitError,\n} from \"@copilotkit/shared\";\nimport { FrontendAction } from \"../../types/frontend-action\";\nimport useFlatCategoryStore from \"../../hooks/use-flat-category-store\";\nimport { CopilotKitProps } from \"./copilotkit-props\";\nimport { CoAgentStateRender } from \"../../types/coagent-action\";\nimport { CoagentState } from \"../../types/coagent-state\";\nimport { CopilotMessages, MessagesTapProvider } from \"./copilot-messages\";\nimport { ToastProvider } from \"../toast/toast-provider\";\nimport { getErrorActions, UsageBanner } from \"../usage-banner\";\nimport { useCopilotRuntimeClient } from \"../../hooks/use-copilot-runtime-client\";\nimport { shouldShowDevConsole } from \"../../utils\";\nimport { CopilotErrorBoundary } from \"../error-boundary/error-boundary\";\nimport { Agent, ExtensionsInput } from \"@copilotkit/runtime-client-gql\";\nimport {\n LangGraphInterruptAction,\n LangGraphInterruptActionSetterArgs,\n} from \"../../types/interrupt-action\";\nimport { ConsoleTrigger } from \"../dev-console/console-trigger\";\n\nexport function CopilotKit({ children, ...props }: CopilotKitProps) {\n const enabled = shouldShowDevConsole(props.showDevConsole);\n\n // Use API key if provided, otherwise use the license key\n const publicApiKey = props.publicApiKey || props.publicLicenseKey;\n\n return (\n <ToastProvider enabled={enabled}>\n <CopilotErrorBoundary publicApiKey={publicApiKey} showUsageBanner={enabled}>\n <CopilotKitInternal {...props}>{children}</CopilotKitInternal>\n </CopilotErrorBoundary>\n </ToastProvider>\n );\n}\n\nexport function CopilotKitInternal(cpkProps: CopilotKitProps) {\n const { children, ...props } = cpkProps;\n\n /**\n * This will throw an error if the props are invalid.\n */\n validateProps(cpkProps);\n\n // Use license key as API key if provided, otherwise use the API key\n const publicApiKey = props.publicLicenseKey || props.publicApiKey;\n\n const chatApiEndpoint = props.runtimeUrl || COPILOT_CLOUD_CHAT_URL;\n\n const [actions, setActions] = useState<Record<string, FrontendAction<any>>>({});\n const [coAgentStateRenders, setCoAgentStateRenders] = useState<\n Record<string, CoAgentStateRender<any>>\n >({});\n\n const chatComponentsCache = useRef<ChatComponentsCache>({\n actions: {},\n coAgentStateRenders: {},\n });\n\n const { addElement, removeElement, printTree, getAllElements } = useTree();\n const [isLoading, setIsLoading] = useState(false);\n const [chatInstructions, setChatInstructions] = useState(\"\");\n const [authStates, setAuthStates] = useState<Record<string, AuthState>>({});\n const [extensions, setExtensions] = useState<ExtensionsInput>({});\n const [additionalInstructions, setAdditionalInstructions] = useState<string[]>([]);\n\n const {\n addElement: addDocument,\n removeElement: removeDocument,\n allElements: allDocuments,\n } = useFlatCategoryStore<DocumentPointer>();\n\n // Compute all the functions and properties that we need to pass\n const setAction = useCallback((id: string, action: FrontendAction<any>) => {\n setActions((prevPoints) => {\n return {\n ...prevPoints,\n [id]: action,\n };\n });\n }, []);\n\n const removeAction = useCallback((id: string) => {\n setActions((prevPoints) => {\n const newPoints = { ...prevPoints };\n delete newPoints[id];\n return newPoints;\n });\n }, []);\n\n const setCoAgentStateRender = useCallback((id: string, stateRender: CoAgentStateRender<any>) => {\n setCoAgentStateRenders((prevPoints) => {\n return {\n ...prevPoints,\n [id]: stateRender,\n };\n });\n }, []);\n\n const removeCoAgentStateRender = useCallback((id: string) => {\n setCoAgentStateRenders((prevPoints) => {\n const newPoints = { ...prevPoints };\n delete newPoints[id];\n return newPoints;\n });\n }, []);\n\n const getContextString = useCallback(\n (documents: DocumentPointer[], categories: string[]) => {\n const documentsString = documents\n .map((document) => {\n return `${document.name} (${document.sourceApplication}):\\n${document.getContents()}`;\n })\n .join(\"\\n\\n\");\n\n const nonDocumentStrings = printTree(categories);\n\n return `${documentsString}\\n\\n${nonDocumentStrings}`;\n },\n [printTree],\n );\n\n const addContext = useCallback(\n (\n context: string,\n parentId?: string,\n categories: string[] = defaultCopilotContextCategories,\n ) => {\n return addElement(context, categories, parentId);\n },\n [addElement],\n );\n\n const removeContext = useCallback(\n (id: string) => {\n removeElement(id);\n },\n [removeElement],\n );\n\n const getAllContext = useCallback(() => {\n return getAllElements();\n }, [getAllElements]);\n\n const getFunctionCallHandler = useCallback(\n (customEntryPoints?: Record<string, FrontendAction<any>>) => {\n return entryPointsToFunctionCallHandler(Object.values(customEntryPoints || actions));\n },\n [actions],\n );\n\n const getDocumentsContext = useCallback(\n (categories: string[]) => {\n return allDocuments(categories);\n },\n [allDocuments],\n );\n\n const addDocumentContext = useCallback(\n (documentPointer: DocumentPointer, categories: string[] = defaultCopilotContextCategories) => {\n return addDocument(documentPointer, categories);\n },\n [addDocument],\n );\n\n const removeDocumentContext = useCallback(\n (documentId: string) => {\n removeDocument(documentId);\n },\n [removeDocument],\n );\n\n // get the appropriate CopilotApiConfig from the props\n const copilotApiConfig: CopilotApiConfig = useMemo(() => {\n let cloud: CopilotCloudConfig | undefined = undefined;\n if (publicApiKey) {\n cloud = {\n guardrails: {\n input: {\n restrictToTopic: {\n enabled: Boolean(props.guardrails_c),\n validTopics: props.guardrails_c?.validTopics || [],\n invalidTopics: props.guardrails_c?.invalidTopics || [],\n },\n },\n },\n };\n }\n\n return {\n publicApiKey: publicApiKey,\n ...(cloud ? { cloud } : {}),\n chatApiEndpoint: chatApiEndpoint,\n headers: props.headers || {},\n properties: props.properties || {},\n transcribeAudioUrl: props.transcribeAudioUrl,\n textToSpeechUrl: props.textToSpeechUrl,\n credentials: props.credentials,\n };\n }, [\n publicApiKey,\n props.headers,\n props.properties,\n props.transcribeAudioUrl,\n props.textToSpeechUrl,\n props.credentials,\n props.cloudRestrictToTopic,\n props.guardrails_c,\n ]);\n\n const headers = useMemo(() => {\n const authHeaders = Object.values(authStates || {}).reduce((acc, state) => {\n if (state.status === \"authenticated\" && state.authHeaders) {\n return {\n ...acc,\n ...Object.entries(state.authHeaders).reduce(\n (headers, [key, value]) => ({\n ...headers,\n [key.startsWith(\"X-Custom-\") ? key : `X-Custom-${key}`]: value,\n }),\n {},\n ),\n };\n }\n return acc;\n }, {});\n\n return {\n ...(copilotApiConfig.headers || {}),\n ...(copilotApiConfig.publicApiKey\n ? { [COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: copilotApiConfig.publicApiKey }\n : {}),\n ...authHeaders,\n };\n }, [copilotApiConfig.headers, copilotApiConfig.publicApiKey, authStates]);\n\n const runtimeClient = useCopilotRuntimeClient({\n url: copilotApiConfig.chatApiEndpoint,\n publicApiKey: publicApiKey,\n headers,\n credentials: copilotApiConfig.credentials,\n showDevConsole: shouldShowDevConsole(props.showDevConsole),\n onError: props.onError,\n });\n\n const [chatSuggestionConfiguration, setChatSuggestionConfiguration] = useState<{\n [key: string]: CopilotChatSuggestionConfiguration;\n }>({});\n\n const addChatSuggestionConfiguration = useCallback(\n (id: string, suggestion: CopilotChatSuggestionConfiguration) => {\n setChatSuggestionConfiguration((prev) => ({ ...prev, [id]: suggestion }));\n },\n [setChatSuggestionConfiguration],\n );\n\n const removeChatSuggestionConfiguration = useCallback(\n (id: string) => {\n setChatSuggestionConfiguration((prev) => {\n const { [id]: _, ...rest } = prev;\n return rest;\n });\n },\n [setChatSuggestionConfiguration],\n );\n\n const [availableAgents, setAvailableAgents] = useState<Agent[]>([]);\n const [coagentStates, setCoagentStates] = useState<Record<string, CoagentState>>({});\n const coagentStatesRef = useRef<Record<string, CoagentState>>({});\n const setCoagentStatesWithRef = useCallback(\n (\n value:\n | Record<string, CoagentState>\n | ((prev: Record<string, CoagentState>) => Record<string, CoagentState>),\n ) => {\n const newValue = typeof value === \"function\" ? value(coagentStatesRef.current) : value;\n coagentStatesRef.current = newValue;\n setCoagentStates((prev) => {\n return newValue;\n });\n },\n [],\n );\n const hasLoadedAgents = useRef(false);\n\n useEffect(() => {\n if (hasLoadedAgents.current) return;\n\n const fetchData = async () => {\n const result = await runtimeClient.availableAgents();\n if (result.data?.availableAgents) {\n setAvailableAgents(result.data.availableAgents.agents);\n }\n hasLoadedAgents.current = true;\n };\n void fetchData();\n }, []);\n\n let initialAgentSession: AgentSession | null = null;\n if (props.agent) {\n initialAgentSession = {\n agentName: props.agent,\n };\n }\n\n const [agentSession, setAgentSession] = useState<AgentSession | null>(initialAgentSession);\n\n // Update agentSession when props.agent changes\n useEffect(() => {\n if (props.agent) {\n setAgentSession({\n agentName: props.agent,\n });\n } else {\n setAgentSession(null);\n }\n }, [props.agent]);\n\n const [internalThreadId, setInternalThreadId] = useState<string>(props.threadId || randomUUID());\n const setThreadId = useCallback(\n (value: SetStateAction<string>) => {\n if (props.threadId) {\n throw new Error(\"Cannot call setThreadId() when threadId is provided via props.\");\n }\n setInternalThreadId(value);\n },\n [props.threadId],\n );\n\n // update the internal threadId if the props.threadId changes\n useEffect(() => {\n if (props.threadId !== undefined) {\n setInternalThreadId(props.threadId);\n }\n }, [props.threadId]);\n\n const [runId, setRunId] = useState<string | null>(null);\n\n const chatAbortControllerRef = useRef<AbortController | null>(null);\n\n const showDevConsole = shouldShowDevConsole(props.showDevConsole);\n\n const [langGraphInterruptAction, _setLangGraphInterruptAction] =\n useState<LangGraphInterruptAction | null>(null);\n const setLangGraphInterruptAction = useCallback((action: LangGraphInterruptActionSetterArgs) => {\n _setLangGraphInterruptAction((prev) => {\n if (prev == null) return action as LangGraphInterruptAction;\n if (action == null) return null;\n let event = prev.event;\n if (action.event) {\n // @ts-ignore\n event = { ...prev.event, ...action.event };\n }\n return { ...prev, ...action, event };\n });\n }, []);\n const removeLangGraphInterruptAction = useCallback((): void => {\n setLangGraphInterruptAction(null);\n }, []);\n\n const memoizedChildren = useMemo(() => children, [children]);\n const [bannerError, setBannerError] = useState<CopilotKitError | null>(null);\n\n const agentLock = useMemo(() => props.agent ?? null, [props.agent]);\n\n const forwardedParameters = useMemo(\n () => props.forwardedParameters ?? {},\n [props.forwardedParameters],\n );\n\n const updateExtensions = useCallback(\n (newExtensions: SetStateAction<ExtensionsInput>) => {\n setExtensions((prev: ExtensionsInput) => {\n const resolved = typeof newExtensions === \"function\" ? newExtensions(prev) : newExtensions;\n const isSameLength = Object.keys(resolved).length === Object.keys(prev).length;\n const isEqual =\n isSameLength &&\n // @ts-ignore\n Object.entries(resolved).every(([key, value]) => prev[key] === value);\n\n return isEqual ? prev : resolved;\n });\n },\n [setExtensions],\n );\n\n const updateAuthStates = useCallback(\n (newAuthStates: SetStateAction<Record<string, AuthState>>) => {\n setAuthStates((prev) => {\n const resolved = typeof newAuthStates === \"function\" ? newAuthStates(prev) : newAuthStates;\n const isSameLength = Object.keys(resolved).length === Object.keys(prev).length;\n const isEqual =\n isSameLength &&\n // @ts-ignore\n Object.entries(resolved).every(([key, value]) => prev[key] === value);\n\n return isEqual ? prev : resolved;\n });\n },\n [setAuthStates],\n );\n\n return (\n <CopilotContext.Provider\n value={{\n actions,\n chatComponentsCache,\n getFunctionCallHandler,\n setAction,\n removeAction,\n coAgentStateRenders,\n setCoAgentStateRender,\n removeCoAgentStateRender,\n getContextString,\n addContext,\n removeContext,\n getAllContext,\n getDocumentsContext,\n addDocumentContext,\n removeDocumentContext,\n copilotApiConfig: copilotApiConfig,\n isLoading,\n setIsLoading,\n chatSuggestionConfiguration,\n addChatSuggestionConfiguration,\n removeChatSuggestionConfiguration,\n chatInstructions,\n setChatInstructions,\n additionalInstructions,\n setAdditionalInstructions,\n showDevConsole,\n coagentStates,\n setCoagentStates,\n coagentStatesRef,\n setCoagentStatesWithRef,\n agentSession,\n setAgentSession,\n runtimeClient,\n forwardedParameters,\n agentLock,\n threadId: internalThreadId,\n setThreadId,\n runId,\n setRunId,\n chatAbortControllerRef,\n availableAgents,\n authConfig_c: props.authConfig_c,\n authStates_c: authStates,\n setAuthStates_c: updateAuthStates,\n extensions,\n setExtensions: updateExtensions,\n langGraphInterruptAction,\n setLangGraphInterruptAction,\n removeLangGraphInterruptAction,\n onError: props.onError,\n bannerError,\n setBannerError,\n }}\n >\n <MessagesTapProvider>\n <CopilotMessages>\n {memoizedChildren}\n {showDevConsole && <ConsoleTrigger />}\n </CopilotMessages>\n </MessagesTapProvider>\n {bannerError && showDevConsole && (\n <UsageBanner\n severity={bannerError.severity}\n message={bannerError.message}\n onClose={() => setBannerError(null)}\n actions={getErrorActions(bannerError)}\n />\n )}\n </CopilotContext.Provider>\n );\n}\n\nexport const defaultCopilotContextCategories = [\"global\"];\n\nfunction entryPointsToFunctionCallHandler(actions: FrontendAction<any>[]): FunctionCallHandler {\n return async ({ name, args }: { name: string; args: Record<string, any> }) => {\n let actionsByFunctionName: Record<string, FrontendAction<any>> = {};\n for (let action of actions) {\n actionsByFunctionName[action.name] = action;\n }\n\n const action = actionsByFunctionName[name];\n let result: any = undefined;\n if (action) {\n await new Promise<void>((resolve, reject) => {\n flushSync(async () => {\n try {\n result = await action.handler?.(args);\n resolve();\n } catch (error) {\n reject(error);\n }\n });\n });\n await new Promise((resolve) => setTimeout(resolve, 20));\n }\n return result;\n };\n}\n\nfunction formatFeatureName(featureName: string): string {\n return featureName\n .replace(/_c$/, \"\")\n .split(\"_\")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(\" \");\n}\n\nfunction validateProps(props: CopilotKitProps): never | void {\n const cloudFeatures = Object.keys(props).filter((key) => key.endsWith(\"_c\"));\n\n // Check if we have either a runtimeUrl or one of the API keys\n const hasApiKey = props.publicApiKey || props.publicLicenseKey;\n\n if (!props.runtimeUrl && !hasApiKey) {\n throw new ConfigurationError(\n \"Missing required prop: 'runtimeUrl' or 'publicApiKey' or 'publicLicenseKey'\",\n );\n }\n\n if (cloudFeatures.length > 0 && !hasApiKey) {\n throw new MissingPublicApiKeyError(\n `Missing required prop: 'publicApiKey' or 'publicLicenseKey' to use cloud features: ${cloudFeatures\n .map(formatFeatureName)\n .join(\", \")}`,\n );\n }\n}\n","/**\n * Suggestions utility functions for CopilotKit\n *\n * This module handles the generation of chat suggestions with optimized error handling\n * and streaming validation to prevent infinite retry loops and console spam.\n */\n\nimport { extract } from \"./extract\";\nimport { actionParametersToJsonSchema } from \"@copilotkit/shared\";\nimport { CopilotRequestType } from \"@copilotkit/runtime-client-gql\";\nimport { CopilotContextParams, CopilotMessagesContextParams } from \"../context\";\nimport { CopilotChatSuggestionConfiguration } from \"../types\";\n\nexport interface SuggestionItem {\n title: string;\n message: string;\n partial?: boolean;\n className?: string;\n}\n\nexport const reloadSuggestions = async (\n context: CopilotContextParams & CopilotMessagesContextParams,\n chatSuggestionConfiguration: { [key: string]: CopilotChatSuggestionConfiguration },\n setCurrentSuggestions: (suggestions: SuggestionItem[]) => void,\n abortControllerRef: React.MutableRefObject<AbortController | null>,\n): Promise<void> => {\n const abortController = abortControllerRef.current;\n\n // Early abort check\n if (abortController?.signal.aborted) {\n return;\n }\n\n // Abort-aware suggestion setter with safety checks to prevent race conditions\n const setSuggestionsIfNotAborted = (suggestions: SuggestionItem[]) => {\n if (!abortController?.signal.aborted && abortControllerRef.current === abortController) {\n setCurrentSuggestions(suggestions);\n }\n };\n\n try {\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: SuggestionItem[] = [];\n let hasSuccessfulSuggestions = false;\n let hasErrors = false; // Track if any errors occurred\n let lastError: Error | null = null; // Track the last error for better error reporting\n\n // Get enabled configurations\n const enabledConfigs = Object.values(chatSuggestionConfiguration).filter(\n (config) => config.instructions && config.instructions.trim().length > 0,\n );\n\n if (enabledConfigs.length === 0) {\n return;\n }\n\n // Clear existing suggestions\n setSuggestionsIfNotAborted([]);\n\n // Generate suggestions for each configuration\n for (const config of enabledConfigs) {\n // Check if aborted before each configuration\n if (abortController?.signal.aborted) {\n setSuggestionsIfNotAborted([]);\n return;\n }\n\n try {\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: `${config.instructions}\\n\\nAvailable 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 }: { status: string; args: any }) => {\n // Check abort status in stream callback\n if (abortController?.signal.aborted) {\n return;\n }\n\n const suggestions = args.suggestions || [];\n const newSuggestions: SuggestionItem[] = [];\n\n for (let i = 0; i < suggestions.length; i++) {\n // Respect max suggestions limit\n if (config.maxSuggestions !== undefined && i >= config.maxSuggestions) {\n break;\n }\n\n const suggestion = suggestions[i];\n\n // Skip completely empty or invalid objects during streaming\n if (!suggestion || typeof suggestion !== \"object\") {\n continue;\n }\n\n const { title, message } = suggestion;\n\n // During streaming, be permissive but require at least a meaningful title\n const hasValidTitle = title && typeof title === \"string\" && title.trim().length > 0;\n const hasValidMessage =\n message && typeof message === \"string\" && message.trim().length > 0;\n\n // During streaming, we need at least a title to show something useful\n if (!hasValidTitle) {\n continue;\n }\n\n // Mark as partial if this is the last suggestion and streaming isn't complete\n const partial = i === suggestions.length - 1 && status !== \"complete\";\n\n newSuggestions.push({\n title: title.trim(),\n message: hasValidMessage ? message.trim() : \"\", // Use title as fallback\n partial,\n className: config.className,\n });\n }\n\n // Update suggestions with current batch\n setSuggestionsIfNotAborted([...allSuggestions, ...newSuggestions]);\n },\n });\n\n // Process final results with strict validation\n if (result?.suggestions && Array.isArray(result.suggestions)) {\n const validSuggestions = result.suggestions\n .filter(\n (suggestion: any) =>\n suggestion &&\n typeof suggestion.title === \"string\" &&\n suggestion.title.trim().length > 0,\n )\n .map((suggestion: any) => ({\n title: suggestion.title.trim(),\n message:\n suggestion.message &&\n typeof suggestion.message === \"string\" &&\n suggestion.message.trim()\n ? suggestion.message.trim()\n : suggestion.title.trim(),\n }));\n\n if (validSuggestions.length > 0) {\n allSuggestions.push(...validSuggestions);\n hasSuccessfulSuggestions = true;\n }\n }\n } catch (error) {\n // Simple error handling - just continue with next config, don't log here\n hasErrors = true;\n lastError = error instanceof Error ? error : new Error(String(error));\n }\n }\n\n // Display any successful suggestions we got\n if (hasSuccessfulSuggestions && allSuggestions.length > 0) {\n // Remove duplicates based on message content\n const uniqueSuggestions = allSuggestions.filter(\n (suggestion, index, self) =>\n index === self.findIndex((s) => s.message === suggestion.message),\n );\n\n setSuggestionsIfNotAborted(uniqueSuggestions);\n } else if (hasErrors) {\n // If we had errors but no successful suggestions, throw an error with details\n const errorMessage = lastError\n ? lastError.message\n : \"Failed to generate suggestions due to API errors\";\n throw new Error(errorMessage);\n }\n } catch (error) {\n // Top-level error handler - re-throw to allow caller to handle\n throw error;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EAKE,gCAAAA;AAAA,OACK;AACP;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA,sBAAAC;AAAA,OAEK;;;ACCP,SAAS,aAAa,WAAW,SAAS,QAAQ,gBAAgC;AAUlF,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;;;AC5BP,SAAS,oCAAoC;AAC7C,SAAS,0BAA0B;AAW5B,IAAM,oBAAoB,CAC/B,SACA,6BACA,uBACA,uBACkB;AAClB,QAAM,kBAAkB,mBAAmB;AAG3C,MAAI,mDAAiB,OAAO,SAAS;AACnC;AAAA,EACF;AAGA,QAAM,6BAA6B,CAAC,gBAAkC;AACpE,QAAI,EAAC,mDAAiB,OAAO,YAAW,mBAAmB,YAAY,iBAAiB;AACtF,4BAAsB,WAAW;AAAA,IACnC;AAAA,EACF;AAEA,MAAI;AACF,UAAM,QAAQ,KAAK;AAAA,MACjB,OAAO,OAAO,QAAQ,OAAO,EAAE,IAAI,CAAC,YAAY;AAAA,QAC9C,MAAM,OAAO;AAAA,QACb,aAAa,OAAO;AAAA,QACpB,YAAY,KAAK,UAAU,6BAA6B,OAAO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A,YAEnB,YAAY;AAAA,YACZ,wBAAwB,OAAO;AAAA,UACjC;AAAA,QACF;AAAA,QACA,YAAY,QAAQ,iBAAiB;AAAA,QACrC,QAAQ;AAAA,MACV,CAAC;AAAA,IACH;AAEA,UAAM,SAAS,SAAS,UAAU;AAElC,QAAI,YAAY;AAEhB,QAAI,yBAA6D;AAEjE,WAAO,MAAM;AACX,YAAM,EAAE,MAAM,MAAM,IAAI,MAAM,OAAO,KAAK;AAE1C,UAAI,MAAM;AACR;AAAA,MACF;AAEA,UAAI,2CAAa,SAAS;AACxB,cAAM,IAAI,MAAM,SAAS;AAAA,MAC3B;AAEA,+BAAyB;AAAA,QACvB,MAAM,wBAAwB;AAAA,MAChC,EAAE,KAAK,CAAC,QAAQ,IAAI,yBAAyB,CAAC;AAE9C,UAAI,CAAC,wBAAwB;AAC3B;AAAA,MACF;AAEA,uCAAS;AAAA,QACP,QAAQ,YAAY,YAAY;AAAA,QAChC,MAAM,uBAAuB;AAAA,MAC/B;AAEA,kBAAY;AAAA,IACd;AAEA,QAAI,CAAC,wBAAwB;AAC3B,YAAM,IAAI,MAAM,6CAA6C;AAAA,IAC/D;AAEA,qCAAS;AAAA,MACP,QAAQ;AAAA,MACR,MAAM,uBAAuB;AAAA,IAC/B;AAEA,WAAO,uBAAuB;AAAA,EAChC;AAAA;AAIA,SAAS,wBAAwB,cAA8B;AAC7D,SAAO;AAAA;AAAA;AAAA;AAAA,EAIP;AAAA;AAAA;AAAA;AAAA;AAKF;AAEA,SAAS,kBAAkB,eAAuB,cAA8B;AAC9E,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASF;","names":["actionParametersToJsonSchema","CopilotRequestType","_a","headers","action","CopilotRequestType","actionParametersToJsonSchema"]}
@@ -185,7 +185,7 @@ var getErrorActions = (error) => {
185
185
  primary: {
186
186
  label: "Show me how",
187
187
  onClick: () => window.open(
188
- "https://docs.copilotkit.ai/docs/guides/subscription",
188
+ "https://docs.copilotkit.ai/premium#how-do-i-get-access-to-premium-features",
189
189
  "_blank",
190
190
  "noopener,noreferrer"
191
191
  )
@@ -222,4 +222,4 @@ export {
222
222
  getErrorActions,
223
223
  renderCopilotKitUsage
224
224
  };
225
- //# sourceMappingURL=chunk-OKRZF3DD.mjs.map
225
+ //# sourceMappingURL=chunk-6ZLPNY7X.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/usage-banner.tsx"],"sourcesContent":["import {\n Severity,\n CopilotKitError,\n ErrorVisibility,\n CopilotKitErrorCode,\n} from \"@copilotkit/shared\";\nimport React from \"react\";\n\ninterface UsageBannerProps {\n severity?: Severity;\n message?: string | React.ReactNode;\n onClose?: () => void;\n actions?: {\n primary?: {\n label: string;\n onClick: () => void;\n };\n secondary?: {\n label: string;\n onClick: () => void;\n };\n };\n}\n\nexport function UsageBanner({\n severity = Severity.CRITICAL,\n message = \"\",\n onClose,\n actions,\n}: UsageBannerProps) {\n if (!message || !severity) {\n return null;\n }\n\n const themes = {\n [Severity.INFO]: {\n bg: \"#f8fafc\",\n border: \"#e2e8f0\",\n text: \"#475569\",\n accent: \"#3b82f6\",\n },\n [Severity.WARNING]: {\n bg: \"#fffbeb\",\n border: \"#fbbf24\",\n text: \"#92400e\",\n accent: \"#f59e0b\",\n },\n [Severity.CRITICAL]: {\n bg: \"#fef2f2\",\n border: \"#fecaca\",\n text: \"#dc2626\",\n accent: \"#ef4444\",\n },\n };\n\n const theme = themes[severity];\n\n return (\n <>\n <style>\n {`\n @keyframes slideUp {\n from { opacity: 0; transform: translateX(-50%) translateY(8px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n \n .usage-banner {\n position: fixed;\n bottom: 24px;\n left: 50%;\n transform: translateX(-50%);\n width: min(600px, calc(100vw - 32px));\n z-index: 10000;\n animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);\n }\n \n .banner-content {\n background: linear-gradient(135deg, ${theme.bg} 0%, ${theme.bg}f5 100%);\n border: 1px solid ${theme.border};\n border-radius: 12px;\n padding: 18px 20px;\n box-shadow: \n 0 4px 24px rgba(0, 0, 0, 0.08),\n 0 2px 8px rgba(0, 0, 0, 0.04),\n inset 0 1px 0 rgba(255, 255, 255, 0.7);\n display: flex;\n align-items: center;\n gap: 16px;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;\n backdrop-filter: blur(12px);\n position: relative;\n overflow: hidden;\n }\n \n .banner-content::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 1px;\n background: linear-gradient(90deg, transparent, ${theme.accent}40, transparent);\n }\n \n .banner-message {\n color: ${theme.text};\n font-size: 14px;\n line-height: 1.5;\n font-weight: 500;\n flex: 1;\n letter-spacing: -0.01em;\n }\n \n .close-btn {\n background: rgba(0, 0, 0, 0.05);\n border: none;\n color: ${theme.text};\n cursor: pointer;\n padding: 0;\n border-radius: 6px;\n opacity: 0.6;\n transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);\n font-size: 14px;\n line-height: 1;\n flex-shrink: 0;\n width: 24px;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n .close-btn:hover {\n opacity: 1;\n background: rgba(0, 0, 0, 0.08);\n transform: scale(1.05);\n }\n \n .btn-primary {\n background: linear-gradient(135deg, ${theme.accent} 0%, ${theme.accent}e6 100%);\n color: white;\n border: none;\n border-radius: 8px;\n padding: 10px 18px;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);\n font-family: inherit;\n flex-shrink: 0;\n box-shadow: \n 0 2px 8px ${theme.accent}30,\n inset 0 1px 0 rgba(255, 255, 255, 0.2);\n letter-spacing: -0.01em;\n }\n \n .btn-primary:hover {\n transform: translateY(-1px) scale(1.02);\n box-shadow: \n 0 4px 12px ${theme.accent}40,\n inset 0 1px 0 rgba(255, 255, 255, 0.25);\n }\n \n .btn-primary:active {\n transform: translateY(0) scale(0.98);\n transition: all 0.08s cubic-bezier(0.16, 1, 0.3, 1);\n }\n \n @media (max-width: 640px) {\n .usage-banner {\n width: calc(100vw - 24px);\n }\n \n .banner-content {\n padding: 16px;\n gap: 12px;\n }\n \n .banner-message {\n font-size: 13px;\n line-height: 1.45;\n }\n \n .btn-primary {\n padding: 8px 14px;\n font-size: 12px;\n }\n \n .close-btn {\n width: 22px;\n height: 22px;\n font-size: 12px;\n }\n }\n `}\n </style>\n\n <div className=\"usage-banner\">\n <div className=\"banner-content\">\n <div className=\"banner-message\">{message}</div>\n {actions?.primary && (\n <button className=\"btn-primary\" onClick={actions.primary.onClick}>\n {actions.primary.label}\n </button>\n )}\n {onClose && (\n <button className=\"close-btn\" onClick={onClose} title=\"Close\">\n ×\n </button>\n )}\n </div>\n </div>\n </>\n );\n}\n\n// Get action button based on error type\nexport const getErrorActions = (error: CopilotKitError) => {\n switch (error.code) {\n case CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR:\n return {\n primary: {\n label: \"Show me how\",\n onClick: () =>\n window.open(\n \"https://docs.copilotkit.ai/docs/guides/subscription\",\n \"_blank\",\n \"noopener,noreferrer\",\n ),\n },\n };\n case CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR:\n return {\n primary: {\n label: \"Upgrade\",\n onClick: () =>\n window.open(\"https://cloud.copilotkit.ai\", \"_blank\", \"noopener,noreferrer\"),\n },\n };\n default:\n return undefined;\n }\n};\n\nexport function renderCopilotKitUsage(error: CopilotKitError, onClose?: () => void) {\n // Route based on error visibility level\n if (error.visibility !== ErrorVisibility.BANNER) {\n return null;\n }\n\n return (\n <UsageBanner\n severity={error.severity || Severity.CRITICAL}\n message={error.message}\n onClose={onClose}\n actions={getErrorActions(error)}\n />\n );\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AAqDH,mBACE,KA2IE,YA5IJ;AAlCG,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;AAAA,MACf;AAAA,MACA,SAAS,gBAAgB,KAAK;AAAA;AAAA,EAChC;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../src/components/usage-banner.tsx"],"sourcesContent":["import {\n Severity,\n CopilotKitError,\n ErrorVisibility,\n CopilotKitErrorCode,\n} from \"@copilotkit/shared\";\nimport React from \"react\";\n\ninterface UsageBannerProps {\n severity?: Severity;\n message?: string | React.ReactNode;\n onClose?: () => void;\n actions?: {\n primary?: {\n label: string;\n onClick: () => void;\n };\n secondary?: {\n label: string;\n onClick: () => void;\n };\n };\n}\n\nexport function UsageBanner({\n severity = Severity.CRITICAL,\n message = \"\",\n onClose,\n actions,\n}: UsageBannerProps) {\n if (!message || !severity) {\n return null;\n }\n\n const themes = {\n [Severity.INFO]: {\n bg: \"#f8fafc\",\n border: \"#e2e8f0\",\n text: \"#475569\",\n accent: \"#3b82f6\",\n },\n [Severity.WARNING]: {\n bg: \"#fffbeb\",\n border: \"#fbbf24\",\n text: \"#92400e\",\n accent: \"#f59e0b\",\n },\n [Severity.CRITICAL]: {\n bg: \"#fef2f2\",\n border: \"#fecaca\",\n text: \"#dc2626\",\n accent: \"#ef4444\",\n },\n };\n\n const theme = themes[severity];\n\n return (\n <>\n <style>\n {`\n @keyframes slideUp {\n from { opacity: 0; transform: translateX(-50%) translateY(8px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n \n .usage-banner {\n position: fixed;\n bottom: 24px;\n left: 50%;\n transform: translateX(-50%);\n width: min(600px, calc(100vw - 32px));\n z-index: 10000;\n animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);\n }\n \n .banner-content {\n background: linear-gradient(135deg, ${theme.bg} 0%, ${theme.bg}f5 100%);\n border: 1px solid ${theme.border};\n border-radius: 12px;\n padding: 18px 20px;\n box-shadow: \n 0 4px 24px rgba(0, 0, 0, 0.08),\n 0 2px 8px rgba(0, 0, 0, 0.04),\n inset 0 1px 0 rgba(255, 255, 255, 0.7);\n display: flex;\n align-items: center;\n gap: 16px;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;\n backdrop-filter: blur(12px);\n position: relative;\n overflow: hidden;\n }\n \n .banner-content::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 1px;\n background: linear-gradient(90deg, transparent, ${theme.accent}40, transparent);\n }\n \n .banner-message {\n color: ${theme.text};\n font-size: 14px;\n line-height: 1.5;\n font-weight: 500;\n flex: 1;\n letter-spacing: -0.01em;\n }\n \n .close-btn {\n background: rgba(0, 0, 0, 0.05);\n border: none;\n color: ${theme.text};\n cursor: pointer;\n padding: 0;\n border-radius: 6px;\n opacity: 0.6;\n transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);\n font-size: 14px;\n line-height: 1;\n flex-shrink: 0;\n width: 24px;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n .close-btn:hover {\n opacity: 1;\n background: rgba(0, 0, 0, 0.08);\n transform: scale(1.05);\n }\n \n .btn-primary {\n background: linear-gradient(135deg, ${theme.accent} 0%, ${theme.accent}e6 100%);\n color: white;\n border: none;\n border-radius: 8px;\n padding: 10px 18px;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);\n font-family: inherit;\n flex-shrink: 0;\n box-shadow: \n 0 2px 8px ${theme.accent}30,\n inset 0 1px 0 rgba(255, 255, 255, 0.2);\n letter-spacing: -0.01em;\n }\n \n .btn-primary:hover {\n transform: translateY(-1px) scale(1.02);\n box-shadow: \n 0 4px 12px ${theme.accent}40,\n inset 0 1px 0 rgba(255, 255, 255, 0.25);\n }\n \n .btn-primary:active {\n transform: translateY(0) scale(0.98);\n transition: all 0.08s cubic-bezier(0.16, 1, 0.3, 1);\n }\n \n @media (max-width: 640px) {\n .usage-banner {\n width: calc(100vw - 24px);\n }\n \n .banner-content {\n padding: 16px;\n gap: 12px;\n }\n \n .banner-message {\n font-size: 13px;\n line-height: 1.45;\n }\n \n .btn-primary {\n padding: 8px 14px;\n font-size: 12px;\n }\n \n .close-btn {\n width: 22px;\n height: 22px;\n font-size: 12px;\n }\n }\n `}\n </style>\n\n <div className=\"usage-banner\">\n <div className=\"banner-content\">\n <div className=\"banner-message\">{message}</div>\n {actions?.primary && (\n <button className=\"btn-primary\" onClick={actions.primary.onClick}>\n {actions.primary.label}\n </button>\n )}\n {onClose && (\n <button className=\"close-btn\" onClick={onClose} title=\"Close\">\n ×\n </button>\n )}\n </div>\n </div>\n </>\n );\n}\n\n// Get action button based on error type\nexport const getErrorActions = (error: CopilotKitError) => {\n switch (error.code) {\n case CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR:\n return {\n primary: {\n label: \"Show me how\",\n onClick: () =>\n window.open(\n \"https://docs.copilotkit.ai/premium#how-do-i-get-access-to-premium-features\",\n \"_blank\",\n \"noopener,noreferrer\",\n ),\n },\n };\n case CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR:\n return {\n primary: {\n label: \"Upgrade\",\n onClick: () =>\n window.open(\"https://cloud.copilotkit.ai\", \"_blank\", \"noopener,noreferrer\"),\n },\n };\n default:\n return undefined;\n }\n};\n\nexport function renderCopilotKitUsage(error: CopilotKitError, onClose?: () => void) {\n // Route based on error visibility level\n if (error.visibility !== ErrorVisibility.BANNER) {\n return null;\n }\n\n return (\n <UsageBanner\n severity={error.severity || Severity.CRITICAL}\n message={error.message}\n onClose={onClose}\n actions={getErrorActions(error)}\n />\n );\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AAqDH,mBACE,KA2IE,YA5IJ;AAlCG,SAAS,YAAY;AAAA,EAC1B,WAAW,SAAS;AAAA,EACpB,UAAU;AAAA,EACV;AAAA,EACA;AACF,GAAqB;AACnB,MAAI,CAAC,WAAW,CAAC,UAAU;AACzB,WAAO;AAAA,EACT;AAEA,QAAM,SAAS;AAAA,IACb,CAAC,SAAS,IAAI,GAAG;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esTap
6
- } from "./chunk-TWYUYC4F.mjs";
7
- import {
8
- useAsyncCallback
9
- } from "./chunk-N4WEHORG.mjs";
6
+ } from "./chunk-MUDXTKXE.mjs";
10
7
  import {
11
8
  useCopilotRuntimeClient
12
9
  } from "./chunk-FAUNHSQU.mjs";
13
10
  import {
14
- useCopilotContext
15
- } from "./chunk-TEMLWRRT.mjs";
11
+ useAsyncCallback
12
+ } from "./chunk-N4WEHORG.mjs";
16
13
  import {
17
14
  useToast
18
15
  } from "./chunk-EFL5OBKN.mjs";
16
+ import {
17
+ useCopilotContext
18
+ } from "./chunk-TEMLWRRT.mjs";
19
19
  import {
20
20
  __async,
21
21
  __spreadProps,
@@ -235,4 +235,4 @@ export {
235
235
  stopAgent,
236
236
  runAgent
237
237
  };
238
- //# sourceMappingURL=chunk-COEUPDRL.mjs.map
238
+ //# sourceMappingURL=chunk-BEFEBKKI.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useCopilotChat
3
- } from "./chunk-L6HQIJ74.mjs";
3
+ } from "./chunk-JY3STRON.mjs";
4
4
  import {
5
5
  useCopilotContext
6
6
  } from "./chunk-TEMLWRRT.mjs";
@@ -61,7 +61,7 @@ function useCopilotChatHeadless_c(options = {}) {
61
61
  new CopilotKitError({
62
62
  message: (
63
63
  // add link to documentation here
64
- "You're using useCopilotChatHeadless_c, a subscription-only feature, which offers extensive headless chat capabilities. To continue, you'll need to provide a free subscription key."
64
+ "You're using useCopilotChatHeadless_c, a premium-only feature, which offers extensive headless chat capabilities. To continue, you'll need to provide a free public license key."
65
65
  ),
66
66
  code: CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,
67
67
  severity: Severity.WARNING,
@@ -82,4 +82,4 @@ function useCopilotChatHeadless_c(options = {}) {
82
82
  export {
83
83
  useCopilotChatHeadless_c
84
84
  };
85
- //# sourceMappingURL=chunk-QGE7U4NV.mjs.map
85
+ //# sourceMappingURL=chunk-F26O2HTO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/use-copilot-chat-headless_c.ts"],"sourcesContent":["/**\n * `useCopilotChatHeadless_c` is for building fully custom UI (headless UI) implementations.\n *\n * <Callout title=\"This is a premium-only feature\">\n * Sign up for free on [Copilot Cloud](https://cloud.copilotkit.ai) to get your public license key or read more about [premium features](/premium).\n *\n * Usage is generous, **free** to get started, and works with **either self-hosted or Copilot Cloud** environments.\n * </Callout>\n *\n * ## Key Features\n *\n * - **Fully headless**: Build your own fully custom UI's for your agentic applications.\n * - **Advanced Suggestions**: Direct access to suggestions array with full control\n * - **Interrupt Handling**: Support for advanced interrupt functionality\n * - **MCP Server Support**: Model Context Protocol server configurations\n * - **Chat Controls**: Complete set of chat management functions\n * - **Loading States**: Comprehensive loading state management\n *\n *\n * ## Usage\n *\n * ### Basic Setup\n *\n * ```tsx\n * import { CopilotKit } from \"@copilotkit/react-core\";\n * import { useCopilotChatHeadless_c } from \"@copilotkit/react-core\";\n *\n * export function App() {\n * return (\n * <CopilotKit publicApiKey=\"your-free-public-license-key\">\n * <YourComponent />\n * </CopilotKit>\n * );\n * }\n *\n * export function YourComponent() {\n * const { messages, sendMessage, isLoading } = useCopilotChatHeadless_c();\n *\n * const handleSendMessage = async () => {\n * await sendMessage({\n * id: \"123\",\n * role: \"user\",\n * content: \"Hello World\",\n * });\n * };\n *\n * return (\n * <div>\n * {messages.map(msg => <div key={msg.id}>{msg.content}</div>)}\n * <button onClick={handleSendMessage} disabled={isLoading}>\n * Send Message\n * </button>\n * </div>\n * );\n * }\n * ```\n *\n * ### Working with Suggestions\n *\n * ```tsx\n * import { useCopilotChatHeadless_c, useCopilotChatSuggestions } from \"@copilotkit/react-core\";\n *\n * export function SuggestionExample() {\n * const {\n * suggestions,\n * setSuggestions,\n * generateSuggestions,\n * isLoadingSuggestions\n * } = useCopilotChatHeadless_c();\n *\n * // Configure AI suggestion generation\n * useCopilotChatSuggestions({\n * instructions: \"Suggest helpful actions based on the current context\",\n * maxSuggestions: 3\n * });\n *\n * return (\n * <div>\n * {suggestions.map(suggestion => (\n * <button key={suggestion.title}>{suggestion.title}</button>\n * ))}\n * <button onClick={generateSuggestions} disabled={isLoadingSuggestions}>\n * Generate Suggestions\n * </button>\n * </div>\n * );\n * }\n * ```\n *\n * ## Return Values\n * The following properties are returned from the hook:\n *\n * <PropertyReference name=\"messages\" type=\"Message[]\">\n * The messages currently in the chat in AG-UI format\n * </PropertyReference>\n *\n * <PropertyReference name=\"sendMessage\" type=\"(message: Message, options?) => Promise<void>\">\n * Send a new message to the chat and trigger AI response\n * </PropertyReference>\n *\n * <PropertyReference name=\"setMessages\" type=\"(messages: Message[] | DeprecatedGqlMessage[]) => void\">\n * Replace all messages in the chat with new array\n * </PropertyReference>\n *\n * <PropertyReference name=\"deleteMessage\" type=\"(messageId: string) => void\">\n * Remove a specific message by ID from the chat\n * </PropertyReference>\n *\n * <PropertyReference name=\"reloadMessages\" type=\"(messageId: string) => Promise<void>\">\n * Regenerate the response for a specific message by ID\n * </PropertyReference>\n *\n * <PropertyReference name=\"stopGeneration\" type=\"() => void\">\n * Stop the current message generation process\n * </PropertyReference>\n *\n * <PropertyReference name=\"reset\" type=\"() => void\">\n * Clear all messages and reset chat state completely\n * </PropertyReference>\n *\n * <PropertyReference name=\"isLoading\" type=\"boolean\">\n * Whether the chat is currently generating a response\n * </PropertyReference>\n *\n * <PropertyReference name=\"runChatCompletion\" type=\"() => Promise<Message[]>\">\n * Manually trigger chat completion for advanced usage\n * </PropertyReference>\n *\n * <PropertyReference name=\"mcpServers\" type=\"MCPServerConfig[]\">\n * Array of Model Context Protocol server configurations\n * </PropertyReference>\n *\n * <PropertyReference name=\"setMcpServers\" type=\"(servers: MCPServerConfig[]) => void\">\n * Update MCP server configurations for enhanced context\n * </PropertyReference>\n *\n * <PropertyReference name=\"suggestions\" type=\"SuggestionItem[]\">\n * Current suggestions array for reading or manual control\n * </PropertyReference>\n *\n * <PropertyReference name=\"setSuggestions\" type=\"(suggestions: SuggestionItem[]) => void\">\n * Manually set suggestions for custom workflows\n * </PropertyReference>\n *\n * <PropertyReference name=\"generateSuggestions\" type=\"() => Promise<void>\">\n * Trigger AI-powered suggestion generation using configured settings\n * </PropertyReference>\n *\n * <PropertyReference name=\"resetSuggestions\" type=\"() => void\">\n * Clear all current suggestions and reset generation state\n * </PropertyReference>\n *\n * <PropertyReference name=\"isLoadingSuggestions\" type=\"boolean\">\n * Whether suggestions are currently being generated\n * </PropertyReference>\n *\n * <PropertyReference name=\"interrupt\" type=\"string | React.ReactElement | null\">\n * Interrupt content for human-in-the-loop workflows\n * </PropertyReference>\n */\nimport { useEffect } from \"react\";\nimport { useCopilotContext } from \"../context/copilot-context\";\nimport {\n useCopilotChat as useCopilotChatInternal,\n defaultSystemMessage,\n UseCopilotChatOptions as UseCopilotChatOptions_c,\n UseCopilotChatReturn as UseCopilotChatReturn_c,\n MCPServerConfig,\n} from \"./use-copilot-chat_internal\";\n\nimport {\n ErrorVisibility,\n Severity,\n CopilotKitError,\n CopilotKitErrorCode,\n styledConsole,\n} from \"@copilotkit/shared\";\n\n// Non-functional fallback implementation\nconst createNonFunctionalReturn = (): UseCopilotChatReturn_c => ({\n visibleMessages: [],\n messages: [],\n sendMessage: async () => {},\n appendMessage: async () => {},\n setMessages: () => {},\n deleteMessage: () => {},\n reloadMessages: async () => {},\n stopGeneration: () => {},\n reset: () => {},\n isLoading: false,\n runChatCompletion: async () => [],\n mcpServers: [],\n setMcpServers: () => {},\n suggestions: [],\n setSuggestions: () => {},\n generateSuggestions: async () => {},\n resetSuggestions: () => {},\n isLoadingSuggestions: false,\n interrupt: null,\n});\n/**\n * Enterprise React hook that provides complete chat functionality for fully custom UI implementations.\n * Includes all advanced features like direct message access, suggestions array, interrupt handling, and MCP support.\n *\n * **Requires a publicApiKey** - Sign up for free at https://cloud.copilotkit.ai/\n *\n * @param options - Configuration options for the chat\n * @returns Complete chat interface with all enterprise features\n *\n * @example\n * ```tsx\n * const { messages, sendMessage, suggestions, interrupt } = useCopilotChatHeadless_c();\n * ```\n */\nfunction useCopilotChatHeadless_c(options: UseCopilotChatOptions_c = {}): UseCopilotChatReturn_c {\n const { copilotApiConfig, setBannerError } = useCopilotContext();\n\n // Check if publicApiKey is available\n const hasPublicApiKey = Boolean(copilotApiConfig.publicApiKey);\n\n // Always call the internal hook (follows rules of hooks)\n const internalResult = useCopilotChatInternal(options);\n\n // Set banner error when no public API key is provided\n useEffect(() => {\n if (!hasPublicApiKey) {\n setBannerError(\n new CopilotKitError({\n message:\n // add link to documentation here\n \"You're using useCopilotChatHeadless_c, a premium-only feature, which offers extensive headless chat capabilities. To continue, you'll need to provide a free public license key.\",\n code: CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,\n severity: Severity.WARNING,\n visibility: ErrorVisibility.BANNER,\n }),\n );\n styledConsole.logCopilotKitPlatformMessage();\n } else {\n setBannerError(null); // Clear banner when API key is provided\n }\n }, [hasPublicApiKey]); // Removed setBannerError dependency\n\n // Return internal result if publicApiKey is available, otherwise return fallback\n if (hasPublicApiKey) {\n return internalResult;\n }\n\n // Return non-functional fallback when no publicApiKey\n return createNonFunctionalReturn();\n}\n\nexport { defaultSystemMessage, useCopilotChatHeadless_c };\nexport type { UseCopilotChatOptions_c, UseCopilotChatReturn_c, MCPServerConfig };\n\nconst noKeyWarning = () => {\n styledConsole.logCopilotKitPlatformMessage();\n};\n"],"mappings":";;;;;;;;;;;AAgKA,SAAS,iBAAiB;AAU1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,IAAM,4BAA4B,OAA+B;AAAA,EAC/D,iBAAiB,CAAC;AAAA,EAClB,UAAU,CAAC;AAAA,EACX,aAAa,MAAY;AAAA,EAAC;AAAA,EAC1B,eAAe,MAAY;AAAA,EAAC;AAAA,EAC5B,aAAa,MAAM;AAAA,EAAC;AAAA,EACpB,eAAe,MAAM;AAAA,EAAC;AAAA,EACtB,gBAAgB,MAAY;AAAA,EAAC;AA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