@copilotkit/react-ui 1.7.2-next.1 → 1.8.0-next.3

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 (201) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/{chunk-QXTRFMPM.mjs → chunk-2LRE4W6A.mjs} +13 -11
  3. package/dist/chunk-2LRE4W6A.mjs.map +1 -0
  4. package/dist/{chunk-2C3ANQCY.mjs → chunk-5GNYGURH.mjs} +53 -42
  5. package/dist/chunk-5GNYGURH.mjs.map +1 -0
  6. package/dist/{chunk-CBBFRI3Q.mjs → chunk-5JY5QJ2W.mjs} +9 -5
  7. package/dist/chunk-5JY5QJ2W.mjs.map +1 -0
  8. package/dist/{chunk-OFYI4UU4.mjs → chunk-7RIBDD4K.mjs} +19 -3
  9. package/dist/chunk-7RIBDD4K.mjs.map +1 -0
  10. package/dist/{chunk-YAGE7RCE.mjs → chunk-CGVOCLHN.mjs} +2 -2
  11. package/dist/chunk-EJG6RRSX.mjs +138 -0
  12. package/dist/chunk-EJG6RRSX.mjs.map +1 -0
  13. package/dist/chunk-FBYETUFL.mjs +118 -0
  14. package/dist/chunk-FBYETUFL.mjs.map +1 -0
  15. package/dist/chunk-GDJAAFIK.mjs +24 -0
  16. package/dist/chunk-GDJAAFIK.mjs.map +1 -0
  17. package/dist/{chunk-6FTRYYR5.mjs → chunk-GJME6MK4.mjs} +72 -62
  18. package/dist/chunk-GJME6MK4.mjs.map +1 -0
  19. package/dist/{chunk-AZU4QOV5.mjs → chunk-KG6DW6R2.mjs} +12 -12
  20. package/dist/{chunk-3PJA5MFR.mjs → chunk-LKCAF2HG.mjs} +2 -2
  21. package/dist/{chunk-ADTTDBLB.mjs → chunk-LXCH2BIB.mjs} +2 -2
  22. package/dist/chunk-MCO235PS.mjs +164 -0
  23. package/dist/chunk-MCO235PS.mjs.map +1 -0
  24. package/dist/chunk-MWC5OV7Z.mjs +1 -0
  25. package/dist/chunk-N7LTE54T.mjs +1 -0
  26. package/dist/chunk-N7LTE54T.mjs.map +1 -0
  27. package/dist/chunk-ORSMX3SE.mjs +244 -0
  28. package/dist/chunk-ORSMX3SE.mjs.map +1 -0
  29. package/dist/{chunk-UPTB2MVO.mjs → chunk-PCTCOQK2.mjs} +4 -10
  30. package/dist/chunk-PCTCOQK2.mjs.map +1 -0
  31. package/dist/{chunk-22K5DDPF.mjs → chunk-QGK5GOSC.mjs} +31 -60
  32. package/dist/chunk-QGK5GOSC.mjs.map +1 -0
  33. package/dist/{chunk-WGAZXTUA.mjs → chunk-TOQ7P4DO.mjs} +6 -9
  34. package/dist/chunk-TOQ7P4DO.mjs.map +1 -0
  35. package/dist/chunk-UCVCAGU7.mjs +1 -0
  36. package/dist/chunk-UCVCAGU7.mjs.map +1 -0
  37. package/dist/{chunk-3XAXY2Z3.mjs → chunk-UZTZXMYS.mjs} +2 -2
  38. package/dist/{chunk-RQNJNK2W.mjs → chunk-VC4NO5QZ.mjs} +2 -2
  39. package/dist/{chunk-YQ3D5IQV.mjs → chunk-XNQO5AZZ.mjs} +2 -5
  40. package/dist/chunk-XNQO5AZZ.mjs.map +1 -0
  41. package/dist/chunk-YC4NBUGE.mjs +97 -0
  42. package/dist/chunk-YC4NBUGE.mjs.map +1 -0
  43. package/dist/components/chat/Button.js.map +1 -1
  44. package/dist/components/chat/Button.mjs +3 -3
  45. package/dist/components/chat/Chat.d.ts +17 -1
  46. package/dist/components/chat/Chat.js +378 -905
  47. package/dist/components/chat/Chat.js.map +1 -1
  48. package/dist/components/chat/Chat.mjs +12 -19
  49. package/dist/components/chat/ChatContext.d.ts +20 -0
  50. package/dist/components/chat/ChatContext.js +44 -74
  51. package/dist/components/chat/ChatContext.js.map +1 -1
  52. package/dist/components/chat/ChatContext.mjs +2 -2
  53. package/dist/components/chat/CodeBlock.js +58 -82
  54. package/dist/components/chat/CodeBlock.js.map +1 -1
  55. package/dist/components/chat/CodeBlock.mjs +2 -2
  56. package/dist/components/chat/Header.js +516 -4
  57. package/dist/components/chat/Header.js.map +1 -1
  58. package/dist/components/chat/Header.mjs +10 -3
  59. package/dist/components/chat/Icons.d.ts +10 -9
  60. package/dist/components/chat/Icons.js +125 -164
  61. package/dist/components/chat/Icons.js.map +1 -1
  62. package/dist/components/chat/Icons.mjs +9 -5
  63. package/dist/components/chat/Input.d.ts +1 -1
  64. package/dist/components/chat/Input.js +11 -9
  65. package/dist/components/chat/Input.js.map +1 -1
  66. package/dist/components/chat/Input.mjs +3 -3
  67. package/dist/components/chat/Markdown.js +58 -56
  68. package/dist/components/chat/Markdown.js.map +1 -1
  69. package/dist/components/chat/Markdown.mjs +3 -3
  70. package/dist/components/chat/Messages.d.ts +1 -1
  71. package/dist/components/chat/Messages.js +70 -60
  72. package/dist/components/chat/Messages.js.map +1 -1
  73. package/dist/components/chat/Messages.mjs +3 -3
  74. package/dist/components/chat/Modal.js +1708 -1749
  75. package/dist/components/chat/Modal.js.map +1 -1
  76. package/dist/components/chat/Modal.mjs +23 -23
  77. package/dist/components/chat/Popup.js +1708 -1749
  78. package/dist/components/chat/Popup.js.map +1 -1
  79. package/dist/components/chat/Popup.mjs +24 -24
  80. package/dist/components/chat/Response.js.map +1 -1
  81. package/dist/components/chat/Response.mjs +3 -3
  82. package/dist/components/chat/Sidebar.js +1710 -1751
  83. package/dist/components/chat/Sidebar.js.map +1 -1
  84. package/dist/components/chat/Sidebar.mjs +24 -24
  85. package/dist/components/chat/Suggestion.js +4 -40
  86. package/dist/components/chat/Suggestion.js.map +1 -1
  87. package/dist/components/chat/Suggestion.mjs +2 -2
  88. package/dist/components/chat/Window.js.map +1 -1
  89. package/dist/components/chat/Window.mjs +3 -3
  90. package/dist/components/chat/index.js +1710 -1751
  91. package/dist/components/chat/index.js.map +1 -1
  92. package/dist/components/chat/index.mjs +27 -27
  93. package/dist/components/chat/messages/AssistantMessage.js +211 -59
  94. package/dist/components/chat/messages/AssistantMessage.js.map +1 -1
  95. package/dist/components/chat/messages/AssistantMessage.mjs +5 -5
  96. package/dist/components/chat/messages/RenderTextMessage.js +18 -2
  97. package/dist/components/chat/messages/RenderTextMessage.js.map +1 -1
  98. package/dist/components/chat/messages/RenderTextMessage.mjs +1 -1
  99. package/dist/components/chat/props.d.ts +53 -0
  100. package/dist/components/chat/props.js.map +1 -1
  101. package/dist/components/crew/DefaultResponseRenderer.d.ts +110 -0
  102. package/dist/components/crew/DefaultResponseRenderer.js +175 -0
  103. package/dist/components/crew/DefaultResponseRenderer.js.map +1 -0
  104. package/dist/components/crew/DefaultResponseRenderer.mjs +10 -0
  105. package/dist/components/crew/DefaultResponseRenderer.mjs.map +1 -0
  106. package/dist/components/crew/DefaultStateRenderer.d.ts +88 -0
  107. package/dist/components/crew/DefaultStateRenderer.js +198 -0
  108. package/dist/components/crew/DefaultStateRenderer.js.map +1 -0
  109. package/dist/components/crew/DefaultStateRenderer.mjs +8 -0
  110. package/dist/components/crew/DefaultStateRenderer.mjs.map +1 -0
  111. package/dist/components/crew/index.d.ts +4 -0
  112. package/dist/components/crew/index.js +335 -0
  113. package/dist/components/crew/index.js.map +1 -0
  114. package/dist/components/crew/index.mjs +16 -0
  115. package/dist/components/crew/index.mjs.map +1 -0
  116. package/dist/components/crew/types.d.ts +340 -0
  117. package/dist/components/crew/types.js +19 -0
  118. package/dist/components/crew/types.js.map +1 -0
  119. package/dist/components/crew/types.mjs +2 -0
  120. package/dist/components/crew/types.mjs.map +1 -0
  121. package/dist/components/dev-console/console.js +51 -233
  122. package/dist/components/dev-console/console.js.map +1 -1
  123. package/dist/components/dev-console/console.mjs +5 -5
  124. package/dist/components/dev-console/index.js +51 -233
  125. package/dist/components/dev-console/index.js.map +1 -1
  126. package/dist/components/dev-console/index.mjs +5 -5
  127. package/dist/components/help-modal/index.js +29 -147
  128. package/dist/components/help-modal/index.js.map +1 -1
  129. package/dist/components/help-modal/index.mjs +1 -1
  130. package/dist/components/help-modal/modal.js +29 -147
  131. package/dist/components/help-modal/modal.js.map +1 -1
  132. package/dist/components/help-modal/modal.mjs +1 -1
  133. package/dist/components/index.d.ts +3 -0
  134. package/dist/components/index.js +2191 -1942
  135. package/dist/components/index.js.map +1 -1
  136. package/dist/components/index.mjs +43 -31
  137. package/dist/index.css +481 -90
  138. package/dist/index.css.map +1 -1
  139. package/dist/index.d.ts +3 -0
  140. package/dist/index.js +2192 -1943
  141. package/dist/index.js.map +1 -1
  142. package/dist/index.mjs +43 -31
  143. package/dist/types/css.d.ts +7 -1
  144. package/dist/types/css.js.map +1 -1
  145. package/package.json +4 -4
  146. package/src/components/chat/Chat.tsx +59 -22
  147. package/src/components/chat/ChatContext.tsx +29 -1
  148. package/src/components/chat/CodeBlock.tsx +2 -4
  149. package/src/components/chat/Header.tsx +8 -3
  150. package/src/components/chat/Icons.tsx +108 -108
  151. package/src/components/chat/Input.tsx +42 -38
  152. package/src/components/chat/Markdown.tsx +0 -3
  153. package/src/components/chat/Messages.tsx +68 -56
  154. package/src/components/chat/Suggestion.tsx +2 -3
  155. package/src/components/chat/messages/AssistantMessage.tsx +95 -3
  156. package/src/components/chat/messages/RenderTextMessage.tsx +17 -1
  157. package/src/components/chat/props.ts +66 -0
  158. package/src/components/crew/DefaultResponseRenderer.tsx +298 -0
  159. package/src/components/crew/DefaultStateRenderer.tsx +326 -0
  160. package/src/components/crew/index.ts +3 -0
  161. package/src/components/crew/types.ts +398 -0
  162. package/src/components/dev-console/console.tsx +16 -54
  163. package/src/components/help-modal/modal.tsx +38 -101
  164. package/src/components/index.ts +1 -0
  165. package/src/css/button.css +15 -4
  166. package/src/css/colors.css +27 -6
  167. package/src/css/console.css +46 -39
  168. package/src/css/crew.css +277 -0
  169. package/src/css/header.css +22 -5
  170. package/src/css/input.css +24 -17
  171. package/src/css/markdown.css +2 -1
  172. package/src/css/messages.css +125 -15
  173. package/src/css/panel.css +1 -0
  174. package/src/css/suggestions.css +14 -6
  175. package/src/styles.css +1 -0
  176. package/src/types/css.ts +7 -1
  177. package/dist/chunk-22K5DDPF.mjs.map +0 -1
  178. package/dist/chunk-2C3ANQCY.mjs.map +0 -1
  179. package/dist/chunk-3VNMQWGT.mjs +0 -25
  180. package/dist/chunk-3VNMQWGT.mjs.map +0 -1
  181. package/dist/chunk-6FTRYYR5.mjs.map +0 -1
  182. package/dist/chunk-CBBFRI3Q.mjs.map +0 -1
  183. package/dist/chunk-FZC7X5PK.mjs +0 -262
  184. package/dist/chunk-FZC7X5PK.mjs.map +0 -1
  185. package/dist/chunk-MMVDU6DF.mjs +0 -1
  186. package/dist/chunk-OFYI4UU4.mjs.map +0 -1
  187. package/dist/chunk-QXTRFMPM.mjs.map +0 -1
  188. package/dist/chunk-TI7SY2RI.mjs +0 -164
  189. package/dist/chunk-TI7SY2RI.mjs.map +0 -1
  190. package/dist/chunk-UPTB2MVO.mjs.map +0 -1
  191. package/dist/chunk-VEC45H6Q.mjs +0 -18
  192. package/dist/chunk-VEC45H6Q.mjs.map +0 -1
  193. package/dist/chunk-WGAZXTUA.mjs.map +0 -1
  194. package/dist/chunk-YQ3D5IQV.mjs.map +0 -1
  195. /package/dist/{chunk-YAGE7RCE.mjs.map → chunk-CGVOCLHN.mjs.map} +0 -0
  196. /package/dist/{chunk-AZU4QOV5.mjs.map → chunk-KG6DW6R2.mjs.map} +0 -0
  197. /package/dist/{chunk-3PJA5MFR.mjs.map → chunk-LKCAF2HG.mjs.map} +0 -0
  198. /package/dist/{chunk-ADTTDBLB.mjs.map → chunk-LXCH2BIB.mjs.map} +0 -0
  199. /package/dist/{chunk-MMVDU6DF.mjs.map → chunk-MWC5OV7Z.mjs.map} +0 -0
  200. /package/dist/{chunk-3XAXY2Z3.mjs.map → chunk-UZTZXMYS.mjs.map} +0 -0
  201. /package/dist/{chunk-RQNJNK2W.mjs.map → chunk-VC4NO5QZ.mjs.map} +0 -0
@@ -26,6 +26,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var __async = (__this, __arguments, generator) => {
30
+ return new Promise((resolve, reject) => {
31
+ var fulfilled = (value) => {
32
+ try {
33
+ step(generator.next(value));
34
+ } catch (e) {
35
+ reject(e);
36
+ }
37
+ };
38
+ var rejected = (value) => {
39
+ try {
40
+ step(generator.throw(value));
41
+ } catch (e) {
42
+ reject(e);
43
+ }
44
+ };
45
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
46
+ step((generator = generator.apply(__this, __arguments)).next());
47
+ });
48
+ };
29
49
 
30
50
  // src/components/chat/Header.tsx
31
51
  var Header_exports = {};
@@ -36,7 +56,13 @@ module.exports = __toCommonJS(Header_exports);
36
56
 
37
57
  // src/components/chat/ChatContext.tsx
38
58
  var import_react = __toESM(require("react"));
59
+
60
+ // src/components/chat/Icons.tsx
39
61
  var import_jsx_runtime = require("react/jsx-runtime");
62
+ var SmallSpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitSpinner", style: { width: "13px", height: "13px" } });
63
+
64
+ // src/components/chat/ChatContext.tsx
65
+ var import_jsx_runtime2 = require("react/jsx-runtime");
40
66
  var ChatContext = import_react.default.createContext(void 0);
41
67
  function useChatContext() {
42
68
  const context = import_react.default.useContext(ChatContext);
@@ -48,13 +74,499 @@ function useChatContext() {
48
74
  return context;
49
75
  }
50
76
 
77
+ // src/components/dev-console/utils.ts
78
+ var import_react_core = require("@copilotkit/react-core");
79
+ function shouldShowDevConsole(showDevConsole) {
80
+ if (typeof showDevConsole === "boolean") {
81
+ return showDevConsole;
82
+ }
83
+ return getHostname() === "localhost" || getHostname() === "127.0.0.1" || getHostname() === "0.0.0.0" || getHostname() === "::1";
84
+ }
85
+ function getHostname() {
86
+ if (typeof window !== "undefined" && window.location) {
87
+ return window.location.hostname;
88
+ }
89
+ return "";
90
+ }
91
+ function getPublishedCopilotKitVersion(current, forceCheck = false) {
92
+ return __async(this, null, function* () {
93
+ const LOCAL_STORAGE_KEY = "__copilotkit_version_check__";
94
+ const serializedVersion = localStorage.getItem(LOCAL_STORAGE_KEY);
95
+ if (serializedVersion && !forceCheck) {
96
+ try {
97
+ const parsedVersion = JSON.parse(serializedVersion);
98
+ const oneHour = 60 * 60 * 1e3;
99
+ const now = (/* @__PURE__ */ new Date()).getTime();
100
+ if (parsedVersion.current === current && now - new Date(parsedVersion.lastChecked).getTime() < oneHour) {
101
+ return parsedVersion;
102
+ }
103
+ } catch (error) {
104
+ console.error("Failed to parse CopilotKitVersion from localStorage", error);
105
+ }
106
+ }
107
+ try {
108
+ const response = yield fetch("https://api.cloud.copilotkit.ai/check-for-updates", {
109
+ method: "POST",
110
+ headers: {
111
+ "Content-Type": "application/json"
112
+ },
113
+ body: JSON.stringify({
114
+ packages: [
115
+ {
116
+ packageName: "@copilotkit/shared",
117
+ packageVersion: current
118
+ }
119
+ ]
120
+ })
121
+ });
122
+ const data = yield response.json();
123
+ const version = {
124
+ current,
125
+ lastChecked: (/* @__PURE__ */ new Date()).getTime(),
126
+ latest: data.packages[0].latestVersion,
127
+ severity: data.packages[0].severity,
128
+ advisory: data.packages[0].advisory || null
129
+ };
130
+ localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(version));
131
+ return version;
132
+ } catch (error) {
133
+ console.error("Failed to check for updates", error);
134
+ throw error;
135
+ }
136
+ });
137
+ }
138
+ function logReadables(context) {
139
+ console.log("%cCurrent Readables:", "font-size: 16px; font-weight: bold;");
140
+ const readables = context.getContextString([], import_react_core.defaultCopilotContextCategories).trim();
141
+ if (readables.length === 0) {
142
+ console.log("No readables found");
143
+ return;
144
+ }
145
+ console.log(readables);
146
+ }
147
+ function logActions(context) {
148
+ console.log("%cCurrent Actions:", "font-size: 16px; font-weight: bold;");
149
+ if (Object.values(context.actions).length === 0) {
150
+ console.log("No actions found");
151
+ return;
152
+ }
153
+ for (const action of Object.values(context.actions)) {
154
+ console.group(action.name);
155
+ console.log("name", action.name);
156
+ console.log("description", action.description);
157
+ console.log("parameters", action.parameters);
158
+ console.groupEnd();
159
+ }
160
+ }
161
+ function logMessages(context) {
162
+ console.log("%cCurrent Messages:", "font-size: 16px; font-weight: bold;");
163
+ if (context.messages.length === 0) {
164
+ console.log("No messages found");
165
+ return;
166
+ }
167
+ const tableData = context.messages.map((message) => {
168
+ if (message.isTextMessage()) {
169
+ return {
170
+ id: message.id,
171
+ type: "TextMessage",
172
+ role: message.role,
173
+ name: void 0,
174
+ scope: void 0,
175
+ content: message.content
176
+ };
177
+ } else if (message.isActionExecutionMessage()) {
178
+ return {
179
+ id: message.id,
180
+ type: "ActionExecutionMessage",
181
+ role: void 0,
182
+ name: message.name,
183
+ scope: message.parentMessageId,
184
+ content: message.arguments
185
+ };
186
+ } else if (message.isResultMessage()) {
187
+ return {
188
+ id: message.id,
189
+ type: "ResultMessage",
190
+ role: void 0,
191
+ name: message.actionName,
192
+ scope: message.actionExecutionId,
193
+ content: message.result
194
+ };
195
+ } else if (message.isAgentStateMessage()) {
196
+ return {
197
+ id: message.id,
198
+ type: `AgentStateMessage (running: ${message.running})`,
199
+ role: message.role,
200
+ name: void 0,
201
+ scope: message.threadId,
202
+ content: message.state
203
+ };
204
+ }
205
+ });
206
+ console.table(tableData);
207
+ }
208
+
209
+ // src/components/dev-console/console.tsx
210
+ var import_react_core2 = require("@copilotkit/react-core");
211
+ var import_react3 = require("react");
212
+
213
+ // src/components/dev-console/icons.tsx
214
+ var import_jsx_runtime3 = require("react/jsx-runtime");
215
+ var ExclamationMarkTriangleIcon = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
216
+ "svg",
217
+ {
218
+ width: "13.3967723px",
219
+ height: "12px",
220
+ viewBox: "0 0 13.3967723 12",
221
+ version: "1.1",
222
+ xmlns: "http://www.w3.org/2000/svg",
223
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "exclamation-triangle", fill: "#CD2121", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
224
+ "path",
225
+ {
226
+ d: "M5.39935802,0.75 C5.97670802,-0.25 7.42007802,-0.25 7.99742802,0.75 L13.193588,9.75 C13.770888,10.75 13.049288,12 11.894588,12 L1.50223802,12 C0.34753802,12 -0.37414898,10.75 0.20319802,9.75 L5.39935802,0.75 Z M6.69838802,2.5 C7.11260802,2.5 7.44838802,2.83579 7.44838802,3.25 L7.44838802,6.25 C7.44838802,6.66421 7.11260802,7 6.69838802,7 C6.28417802,7 5.94838802,6.66421 5.94838802,6.25 L5.94838802,3.25 C5.94838802,2.83579 6.28417802,2.5 6.69838802,2.5 Z M6.69838802,10.5 C7.25067802,10.5 7.69838802,10.0523 7.69838802,9.5 C7.69838802,8.9477 7.25067802,8.5 6.69838802,8.5 C6.14610802,8.5 5.69838802,8.9477 5.69838802,9.5 C5.69838802,10.0523 6.14610802,10.5 6.69838802,10.5 Z",
227
+ id: "Shape"
228
+ }
229
+ ) }) })
230
+ }
231
+ );
232
+ var ExclamationMarkIcon = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
233
+ "svg",
234
+ {
235
+ width: "14px",
236
+ height: "14px",
237
+ viewBox: "0 0 14 14",
238
+ version: "1.1",
239
+ xmlns: "http://www.w3.org/2000/svg",
240
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "exclamation-circle", fill: "#EC662C", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
241
+ "path",
242
+ {
243
+ d: "M7,14 C10.866,14 14,10.866 14,7 C14,3.13401 10.866,0 7,0 C3.13401,0 0,3.13401 0,7 C0,10.866 3.13401,14 7,14 Z M7,3 C7.41421,3 7.75,3.33579 7.75,3.75 L7.75,6.75 C7.75,7.16421 7.41421,7.5 7,7.5 C6.58579,7.5 6.25,7.16421 6.25,6.75 L6.25,3.75 C6.25,3.33579 6.58579,3 7,3 Z M7,11 C7.55228,11 8,10.5523 8,10 C8,9.4477 7.55228,9 7,9 C6.44772,9 6,9.4477 6,10 C6,10.5523 6.44772,11 7,11 Z",
244
+ id: "Shape"
245
+ }
246
+ ) }) })
247
+ }
248
+ );
249
+ var ChevronDownIcon = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { width: "7px", height: "4px", viewBox: "0 0 7 4", version: "1.1", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "Group", fill: "#000000", fillRule: "nonzero", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
250
+ "path",
251
+ {
252
+ d: "M3.71690723,3.90271086 C3.59268176,4.03242971 3.39143629,4.03242971 3.26721082,3.90271086 L0.0853966595,0.57605615 C-0.0314221035,0.444981627 -0.0279751448,0.240725043 0.0931934622,0.114040675 C0.214362069,-0.0126436935 0.409725445,-0.0162475626 0.535093061,0.105888951 L3.49205902,3.19746006 L6.44902499,0.105888951 C6.52834574,0.0168884389 6.64780588,-0.0197473458 6.7605411,0.0103538404 C6.87327633,0.0404550266 6.96130636,0.132492308 6.99009696,0.250359396 C7.01888756,0.368226483 6.98384687,0.493124608 6.89872139,0.57605615 L3.71690723,3.90271086 Z",
253
+ id: "Path"
254
+ }
255
+ ) }) }) });
256
+ var CheckIcon = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
257
+ "svg",
258
+ {
259
+ width: "14px",
260
+ height: "14px",
261
+ viewBox: "0 0 14 14",
262
+ version: "1.1",
263
+ xmlns: "http://www.w3.org/2000/svg",
264
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "Group-2", transform: "translate(-118, 0)", fill: "#1BC030", fillRule: "nonzero", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "Group", transform: "translate(118, 0)", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
265
+ "path",
266
+ {
267
+ d: "M0,7 C0,3.13384615 3.13384615,0 7,0 C10.8661538,0 14,3.13384615 14,7 C14,10.8661538 10.8661538,14 7,14 C3.13384615,14 0,10.8661538 0,7 Z M9.59179487,5.69764103 C9.70905818,5.54139023 9.73249341,5.33388318 9.65303227,5.15541491 C9.57357113,4.97694665 9.40367989,4.85551619 9.20909814,4.83811118 C9.01451638,4.82070616 8.82577109,4.91005717 8.71589744,5.07158974 L6.39261538,8.32389744 L5.22666667,7.15794872 C5.01450582,6.96025518 4.68389046,6.9660885 4.47883563,7.17114332 C4.27378081,7.37619815 4.26794748,7.70681351 4.46564103,7.91897436 L6.08102564,9.53435897 C6.19289944,9.64614839 6.3482622,9.70310251 6.50588106,9.69010587 C6.66349993,9.67710922 6.80743532,9.59547613 6.89948718,9.46687179 L9.59179487,5.69764103 L9.59179487,5.69764103 Z",
268
+ id: "Shape"
269
+ }
270
+ ) }) }) })
271
+ }
272
+ );
273
+
274
+ // src/components/dev-console/console.tsx
275
+ var import_react4 = require("@headlessui/react");
276
+ var import_shared = require("@copilotkit/shared");
277
+
278
+ // src/components/help-modal/modal.tsx
279
+ var import_react2 = require("react");
280
+
281
+ // src/components/help-modal/icons.tsx
282
+ var import_jsx_runtime4 = require("react/jsx-runtime");
283
+ var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
284
+ "svg",
285
+ {
286
+ xmlns: "http://www.w3.org/2000/svg",
287
+ fill: "none",
288
+ viewBox: "0 0 24 24",
289
+ strokeWidth: "1.5",
290
+ stroke: "currentColor",
291
+ width: "20",
292
+ height: "20",
293
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
294
+ }
295
+ );
296
+
297
+ // src/components/help-modal/modal.tsx
298
+ var import_jsx_runtime5 = require("react/jsx-runtime");
299
+ function CopilotKitHelpModal() {
300
+ const [showHelpModal, setShowHelpModal] = (0, import_react2.useState)(false);
301
+ const buttonRef = (0, import_react2.useRef)(null);
302
+ const popoverRef = (0, import_react2.useRef)(null);
303
+ (0, import_react2.useEffect)(() => {
304
+ const handleClickOutside = (event) => {
305
+ if (popoverRef.current && !popoverRef.current.contains(event.target) && buttonRef.current && !buttonRef.current.contains(event.target)) {
306
+ setShowHelpModal(false);
307
+ }
308
+ };
309
+ if (showHelpModal) {
310
+ document.addEventListener("mousedown", handleClickOutside);
311
+ }
312
+ return () => {
313
+ document.removeEventListener("mousedown", handleClickOutside);
314
+ };
315
+ }, [showHelpModal]);
316
+ const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
317
+ "button",
318
+ {
319
+ ref: buttonRef,
320
+ onClick: () => setShowHelpModal(!showHelpModal),
321
+ className: "copilotKitDebugMenuTriggerButton relative",
322
+ "aria-label": "Open Help",
323
+ children: "Help"
324
+ }
325
+ );
326
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative", children: [
327
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HelpButton, {}),
328
+ showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
329
+ "div",
330
+ {
331
+ ref: popoverRef,
332
+ className: "absolute mt-2 z-50",
333
+ style: {
334
+ top: "100%",
335
+ right: "-120px",
336
+ width: "380px"
337
+ },
338
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "bg-white rounded-lg shadow-xl w-full p-4 flex-col relative", children: [
339
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
340
+ "button",
341
+ {
342
+ className: "absolute text-gray-400 hover:text-gray-600 focus:outline-none",
343
+ style: { top: "10px", right: "10px" },
344
+ onClick: () => setShowHelpModal(false),
345
+ "aria-label": "Close",
346
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CloseIcon, {})
347
+ }
348
+ ),
349
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "w-full flex mb-6 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { className: "text-2xl font-bold", children: "Help Options" }) }),
350
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-4 mb-4", children: [
351
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
352
+ "a",
353
+ {
354
+ href: "https://docs.copilotkit.ai/coagents/troubleshooting/common-issues",
355
+ target: "_blank",
356
+ rel: "noopener noreferrer",
357
+ children: "Visit the Troubleshooting and FAQ section in the docs"
358
+ }
359
+ ) }),
360
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
361
+ "a",
362
+ {
363
+ href: "https://go.copilotkit.ai/dev-console-support-discord",
364
+ target: "_blank",
365
+ rel: "noopener noreferrer",
366
+ children: "Go to Discord Support Channel (Community Support)"
367
+ }
368
+ ) }),
369
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
370
+ "a",
371
+ {
372
+ href: "https://go.copilotkit.ai/dev-console-support-slack",
373
+ target: "_blank",
374
+ rel: "noopener noreferrer",
375
+ children: "Apply for Priority Direct Slack Support"
376
+ }
377
+ ) })
378
+ ] })
379
+ ] })
380
+ }
381
+ )
382
+ ] });
383
+ }
384
+
385
+ // src/components/dev-console/console.tsx
386
+ var import_jsx_runtime6 = require("react/jsx-runtime");
387
+ function CopilotDevConsole() {
388
+ const currentVersion = import_shared.COPILOTKIT_VERSION;
389
+ const context = (0, import_react_core2.useCopilotContext)();
390
+ const [showDevConsole, setShowDevConsole] = (0, import_react3.useState)(false);
391
+ (0, import_react3.useEffect)(() => {
392
+ setShowDevConsole(shouldShowDevConsole(context.showDevConsole));
393
+ }, [context.showDevConsole]);
394
+ const dontRunTwiceInDevMode = (0, import_react3.useRef)(false);
395
+ const [versionStatus, setVersionStatus] = (0, import_react3.useState)("unknown");
396
+ const [latestVersion, setLatestVersion] = (0, import_react3.useState)("");
397
+ const consoleRef = (0, import_react3.useRef)(null);
398
+ const [debugButtonMode, setDebugButtonMode] = (0, import_react3.useState)("full");
399
+ const checkForUpdates = (force = false) => {
400
+ setVersionStatus("checking");
401
+ getPublishedCopilotKitVersion(currentVersion, force).then((v) => {
402
+ setLatestVersion(v.latest);
403
+ let versionOk = false;
404
+ if (v.current === v.latest) {
405
+ versionOk = true;
406
+ } else if (/[a-zA-Z]/.test(v.current)) {
407
+ versionOk = true;
408
+ }
409
+ if (versionOk) {
410
+ setVersionStatus("latest");
411
+ } else if (v.severity !== "low") {
412
+ setVersionStatus("outdated");
413
+ } else {
414
+ setVersionStatus("update-available");
415
+ }
416
+ }).catch((e) => {
417
+ console.error(e);
418
+ setVersionStatus("unknown");
419
+ });
420
+ };
421
+ (0, import_react3.useEffect)(() => {
422
+ if (dontRunTwiceInDevMode.current === true) {
423
+ return;
424
+ }
425
+ dontRunTwiceInDevMode.current = true;
426
+ checkForUpdates();
427
+ }, []);
428
+ if (!showDevConsole) {
429
+ return null;
430
+ }
431
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
432
+ "div",
433
+ {
434
+ ref: consoleRef,
435
+ className: "copilotKitDevConsole " + (versionStatus === "update-available" ? "copilotKitDevConsoleUpgrade" : "") + (versionStatus === "outdated" ? "copilotKitDevConsoleWarnOutdated" : ""),
436
+ children: [
437
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
438
+ VersionInfo,
439
+ {
440
+ showDevConsole: context.showDevConsole,
441
+ versionStatus,
442
+ currentVersion,
443
+ latestVersion
444
+ }
445
+ ),
446
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CopilotKitHelpModal, {}),
447
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
448
+ DebugMenuButton,
449
+ {
450
+ setShowDevConsole,
451
+ checkForUpdates,
452
+ mode: debugButtonMode
453
+ }
454
+ )
455
+ ]
456
+ }
457
+ );
458
+ }
459
+ function VersionInfo({
460
+ showDevConsole,
461
+ versionStatus,
462
+ currentVersion,
463
+ latestVersion
464
+ }) {
465
+ const [copyStatus, setCopyStatus] = (0, import_react3.useState)("");
466
+ let versionLabel = "";
467
+ let versionIcon = "";
468
+ let currentVersionLabel = currentVersion;
469
+ if (versionStatus === "latest") {
470
+ versionLabel = "latest";
471
+ versionIcon = CheckIcon;
472
+ } else if (versionStatus === "checking") {
473
+ versionLabel = "checking";
474
+ versionIcon = SmallSpinnerIcon;
475
+ } else if (versionStatus === "update-available") {
476
+ versionLabel = "update available";
477
+ versionIcon = ExclamationMarkIcon;
478
+ currentVersionLabel = `${currentVersion} \u2192 ${latestVersion}`;
479
+ } else if (versionStatus === "outdated") {
480
+ versionLabel = "outdated";
481
+ versionIcon = ExclamationMarkTriangleIcon;
482
+ currentVersionLabel = `${currentVersion} \u2192 ${latestVersion}`;
483
+ }
484
+ let asideLabel = "";
485
+ if (showDevConsole === "auto") {
486
+ asideLabel = "(localhost only)";
487
+ } else if (showDevConsole === true) {
488
+ asideLabel = "(always on)";
489
+ }
490
+ const installCommand = [
491
+ `npm install`,
492
+ `@copilotkit/react-core@${latestVersion}`,
493
+ `@copilotkit/react-ui@${latestVersion}`,
494
+ `@copilotkit/react-textarea@${latestVersion}`,
495
+ `&& npm install @copilotkit/runtime@${latestVersion}`
496
+ ].join(" ");
497
+ const handleCopyClick = () => {
498
+ navigator.clipboard.writeText(installCommand.trim()).then(() => {
499
+ setCopyStatus("Command copied to clipboard!");
500
+ setTimeout(() => setCopyStatus(""), 1e3);
501
+ });
502
+ };
503
+ if (versionStatus === "update-available" || versionStatus === "outdated") {
504
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "copilotKitVersionInfo", children: [
505
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { children: [
506
+ currentVersionLabel,
507
+ " ",
508
+ versionIcon
509
+ ] }),
510
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { onClick: handleCopyClick, children: copyStatus || installCommand })
511
+ ] });
512
+ }
513
+ return null;
514
+ }
515
+ function DebugMenuButton({
516
+ setShowDevConsole,
517
+ checkForUpdates,
518
+ mode
519
+ }) {
520
+ const context = (0, import_react_core2.useCopilotContext)();
521
+ const messagesContext = (0, import_react_core2.useCopilotMessagesContext)();
522
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "bg-black top-24 w-52 text-right", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react4.Menu, { children: [
523
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
524
+ import_react4.MenuButton,
525
+ {
526
+ className: `copilotKitDebugMenuTriggerButton ${mode === "compact" ? "compact" : ""}`,
527
+ children: mode == "compact" ? "Debug" : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
528
+ "Debug ",
529
+ ChevronDownIcon
530
+ ] })
531
+ }
532
+ ),
533
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
534
+ import_react4.MenuItems,
535
+ {
536
+ transition: true,
537
+ anchor: "bottom end",
538
+ className: "copilotKitDebugMenu",
539
+ style: { zIndex: 40 },
540
+ children: [
541
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react4.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logReadables(context), children: "Log Readables" }) }),
542
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react4.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logActions(context), children: "Log Actions" }) }),
543
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react4.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
544
+ "button",
545
+ {
546
+ className: "copilotKitDebugMenuItem",
547
+ onClick: () => logMessages(messagesContext),
548
+ children: "Log Messages"
549
+ }
550
+ ) }),
551
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react4.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => checkForUpdates(true), children: "Check for Updates" }) }),
552
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("hr", {}),
553
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react4.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => setShowDevConsole(false), children: "Hide Dev Console" }) })
554
+ ]
555
+ }
556
+ )
557
+ ] }) });
558
+ }
559
+
51
560
  // src/components/chat/Header.tsx
52
- var import_jsx_runtime2 = require("react/jsx-runtime");
561
+ var import_jsx_runtime7 = require("react/jsx-runtime");
53
562
  var Header = ({}) => {
54
563
  const { setOpen, icons, labels } = useChatContext();
55
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "copilotKitHeader", children: [
56
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: labels.title }),
57
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => setOpen(false), "aria-label": "Close", children: icons.headerCloseIcon })
564
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "copilotKitHeader", children: [
565
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: labels.title }),
566
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "copilotKitHeaderControls", children: [
567
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CopilotDevConsole, {}),
568
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { onClick: () => setOpen(false), "aria-label": "Close", children: icons.headerCloseIcon })
569
+ ] })
58
570
  ] });
59
571
  };
60
572
  // Annotate the CommonJS export names for ESM import in node: