@copilotkit/react-core 1.57.3 → 1.58.0-canary.thread-id-propagation

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 (292) hide show
  1. package/LICENSE +21 -0
  2. package/dist/{copilotkit-CtXcs1ea.cjs → copilotkit-B4ouY7qC.cjs} +14 -3
  3. package/dist/copilotkit-B4ouY7qC.cjs.map +1 -0
  4. package/dist/copilotkit-BK9CVq9A.d.cts.map +1 -1
  5. package/dist/{copilotkit-CC8DjOiC.mjs → copilotkit-L4mM_JqG.mjs} +14 -3
  6. package/dist/copilotkit-L4mM_JqG.mjs.map +1 -0
  7. package/dist/copilotkit-WlmeVijs.d.mts.map +1 -1
  8. package/dist/index.cjs +3 -77
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +2 -2
  11. package/dist/index.d.mts +2 -2
  12. package/dist/index.mjs +3 -77
  13. package/dist/index.mjs.map +1 -1
  14. package/dist/index.umd.js +15 -78
  15. package/dist/index.umd.js.map +1 -1
  16. package/dist/v2/headless.cjs +11 -0
  17. package/dist/v2/headless.cjs.map +1 -1
  18. package/dist/v2/headless.d.cts.map +1 -1
  19. package/dist/v2/headless.d.mts.map +1 -1
  20. package/dist/v2/headless.mjs +11 -0
  21. package/dist/v2/headless.mjs.map +1 -1
  22. package/dist/v2/index.cjs +1 -1
  23. package/dist/v2/index.mjs +1 -1
  24. package/dist/v2/index.umd.js +13 -2
  25. package/dist/v2/index.umd.js.map +1 -1
  26. package/package.json +12 -13
  27. package/skills/react-core/SKILL.md +108 -0
  28. package/skills/react-core/references/agent-access.md +288 -0
  29. package/skills/react-core/references/attachments.md +291 -0
  30. package/skills/react-core/references/capabilities.md +138 -0
  31. package/skills/react-core/references/chat-components.md +221 -0
  32. package/skills/react-core/references/client-side-tools.md +358 -0
  33. package/skills/react-core/references/custom-message-renderers.md +226 -0
  34. package/skills/react-core/references/debug-mode.md +153 -0
  35. package/skills/react-core/references/human-in-the-loop.md +312 -0
  36. package/skills/react-core/references/provider-setup.md +326 -0
  37. package/skills/react-core/references/rendering-activity-messages.md +207 -0
  38. package/skills/react-core/references/rendering-tool-calls.md +319 -0
  39. package/skills/react-core/references/suggestions.md +211 -0
  40. package/skills/react-core/references/switching-agents-recipes.md +160 -0
  41. package/skills/react-core/references/switching-agents.md +231 -0
  42. package/skills/react-core/references/threads.md +226 -0
  43. package/.attw.json +0 -3
  44. package/CHANGELOG.md +0 -5043
  45. package/dist/copilotkit-CC8DjOiC.mjs.map +0 -1
  46. package/dist/copilotkit-CtXcs1ea.cjs.map +0 -1
  47. package/scripts/scope-preflight.mjs +0 -100
  48. package/src/components/CopilotListeners.tsx +0 -137
  49. package/src/components/__tests__/CopilotListeners.test.tsx +0 -38
  50. package/src/components/copilot-provider/__tests__/copilot-messages-key.test.tsx +0 -92
  51. package/src/components/copilot-provider/__tests__/copilotkit-error.test.tsx +0 -77
  52. package/src/components/copilot-provider/__tests__/error-visibility-prod.test.tsx +0 -70
  53. package/src/components/copilot-provider/__tests__/v1-explicit-threadid-bridge.test.tsx +0 -107
  54. package/src/components/copilot-provider/copilot-messages.tsx +0 -314
  55. package/src/components/copilot-provider/copilotkit-props.tsx +0 -214
  56. package/src/components/copilot-provider/copilotkit.tsx +0 -853
  57. package/src/components/copilot-provider/index.ts +0 -3
  58. package/src/components/dev-console/console-trigger.tsx +0 -283
  59. package/src/components/dev-console/developer-console-modal.tsx +0 -1016
  60. package/src/components/dev-console/icons.tsx +0 -106
  61. package/src/components/error-boundary/error-boundary.tsx +0 -99
  62. package/src/components/error-boundary/error-utils.tsx +0 -105
  63. package/src/components/index.ts +0 -1
  64. package/src/components/toast/exclamation-mark-icon.tsx +0 -27
  65. package/src/components/toast/toast-provider.tsx +0 -448
  66. package/src/components/usage-banner.tsx +0 -266
  67. package/src/context/__tests__/threads-context.test.tsx +0 -141
  68. package/src/context/coagent-state-renders-context.tsx +0 -89
  69. package/src/context/copilot-context.tsx +0 -365
  70. package/src/context/copilot-messages-context.tsx +0 -35
  71. package/src/context/index.ts +0 -22
  72. package/src/context/threads-context.tsx +0 -69
  73. package/src/hooks/__tests__/use-coagent-config.test.ts +0 -352
  74. package/src/hooks/__tests__/use-coagent-state-render-bridge.helpers.test.ts +0 -107
  75. package/src/hooks/__tests__/use-coagent-state-render.e2e.test.tsx +0 -1209
  76. package/src/hooks/__tests__/use-coagent-state-render.test.tsx +0 -356
  77. package/src/hooks/__tests__/use-copilot-chat-internal-connect.test.tsx +0 -241
  78. package/src/hooks/__tests__/use-frontend-tool-available.test.tsx +0 -72
  79. package/src/hooks/__tests__/use-frontend-tool-remount.e2e.test.tsx +0 -102
  80. package/src/hooks/index.ts +0 -33
  81. package/src/hooks/use-agent-nodename.ts +0 -33
  82. package/src/hooks/use-coagent-state-render-bridge.helpers.ts +0 -345
  83. package/src/hooks/use-coagent-state-render-bridge.tsx +0 -222
  84. package/src/hooks/use-coagent-state-render-registry.ts +0 -230
  85. package/src/hooks/use-coagent-state-render.ts +0 -163
  86. package/src/hooks/use-coagent.ts +0 -377
  87. package/src/hooks/use-configure-chat-suggestions.tsx +0 -96
  88. package/src/hooks/use-copilot-action.ts +0 -245
  89. package/src/hooks/use-copilot-additional-instructions.ts +0 -98
  90. package/src/hooks/use-copilot-authenticated-action.ts +0 -73
  91. package/src/hooks/use-copilot-chat-headless_c.ts +0 -264
  92. package/src/hooks/use-copilot-chat-suggestions.tsx +0 -134
  93. package/src/hooks/use-copilot-chat.ts +0 -132
  94. package/src/hooks/use-copilot-chat_internal.ts +0 -875
  95. package/src/hooks/use-copilot-readable.ts +0 -135
  96. package/src/hooks/use-copilot-runtime-client.ts +0 -178
  97. package/src/hooks/use-default-tool.ts +0 -13
  98. package/src/hooks/use-flat-category-store.ts +0 -109
  99. package/src/hooks/use-frontend-tool.ts +0 -113
  100. package/src/hooks/use-human-in-the-loop.ts +0 -138
  101. package/src/hooks/use-langgraph-interrupt.ts +0 -103
  102. package/src/hooks/use-lazy-tool-renderer.tsx +0 -30
  103. package/src/hooks/use-make-copilot-document-readable.ts +0 -30
  104. package/src/hooks/use-render-tool-call.ts +0 -89
  105. package/src/hooks/use-tree.ts +0 -222
  106. package/src/index.tsx +0 -7
  107. package/src/lib/copilot-task.ts +0 -215
  108. package/src/lib/index.ts +0 -1
  109. package/src/lib/status-checker.ts +0 -67
  110. package/src/setupTests.ts +0 -37
  111. package/src/test-helpers/copilot-context.ts +0 -91
  112. package/src/types/chat-suggestion-configuration.ts +0 -23
  113. package/src/types/coagent-action.ts +0 -35
  114. package/src/types/coagent-state.ts +0 -13
  115. package/src/types/crew.ts +0 -89
  116. package/src/types/document-pointer.ts +0 -7
  117. package/src/types/frontend-action.ts +0 -213
  118. package/src/types/index.ts +0 -17
  119. package/src/types/interrupt-action.ts +0 -58
  120. package/src/types/system-message.ts +0 -4
  121. package/src/utils/dev-console.ts +0 -19
  122. package/src/utils/index.ts +0 -2
  123. package/src/utils/suggestions-constants.ts +0 -8
  124. package/src/utils/utils.test.ts +0 -7
  125. package/src/utils/utils.ts +0 -6
  126. package/src/v2/__tests__/A2UIMessageRenderer.test.tsx +0 -240
  127. package/src/v2/__tests__/globalSetup.ts +0 -14
  128. package/src/v2/__tests__/setup.ts +0 -93
  129. package/src/v2/__tests__/utils/test-helpers.tsx +0 -570
  130. package/src/v2/a2ui/A2UICatalogContext.tsx +0 -79
  131. package/src/v2/a2ui/A2UIMessageRenderer.tsx +0 -294
  132. package/src/v2/a2ui/A2UIToolCallRenderer.tsx +0 -290
  133. package/src/v2/components/CopilotKitInspector.tsx +0 -52
  134. package/src/v2/components/MCPAppsActivityRenderer.tsx +0 -815
  135. package/src/v2/components/OpenGenerativeUIRenderer.tsx +0 -598
  136. package/src/v2/components/WildcardToolCallRender.tsx +0 -86
  137. package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.tsx +0 -665
  138. package/src/v2/components/chat/CopilotChat.tsx +0 -664
  139. package/src/v2/components/chat/CopilotChatAssistantMessage.tsx +0 -393
  140. package/src/v2/components/chat/CopilotChatAttachmentQueue.tsx +0 -374
  141. package/src/v2/components/chat/CopilotChatAttachmentRenderer.tsx +0 -159
  142. package/src/v2/components/chat/CopilotChatAudioRecorder.tsx +0 -350
  143. package/src/v2/components/chat/CopilotChatInput.tsx +0 -1412
  144. package/src/v2/components/chat/CopilotChatMessageView.tsx +0 -716
  145. package/src/v2/components/chat/CopilotChatReasoningMessage.tsx +0 -265
  146. package/src/v2/components/chat/CopilotChatSuggestionPill.tsx +0 -59
  147. package/src/v2/components/chat/CopilotChatSuggestionView.tsx +0 -134
  148. package/src/v2/components/chat/CopilotChatToggleButton.tsx +0 -171
  149. package/src/v2/components/chat/CopilotChatToolCallsView.tsx +0 -40
  150. package/src/v2/components/chat/CopilotChatUserMessage.tsx +0 -445
  151. package/src/v2/components/chat/CopilotChatView.tsx +0 -890
  152. package/src/v2/components/chat/CopilotModalHeader.tsx +0 -129
  153. package/src/v2/components/chat/CopilotPopup.tsx +0 -81
  154. package/src/v2/components/chat/CopilotPopupView.tsx +0 -317
  155. package/src/v2/components/chat/CopilotSidebar.tsx +0 -80
  156. package/src/v2/components/chat/CopilotSidebarView.tsx +0 -269
  157. package/src/v2/components/chat/Lightbox.tsx +0 -103
  158. package/src/v2/components/chat/__tests__/CopilotChat.absentThreadConnect.test.tsx +0 -66
  159. package/src/v2/components/chat/__tests__/CopilotChat.attachments.test.tsx +0 -168
  160. package/src/v2/components/chat/__tests__/CopilotChat.e2e.test.tsx +0 -1239
  161. package/src/v2/components/chat/__tests__/CopilotChat.onError.test.tsx +0 -73
  162. package/src/v2/components/chat/__tests__/CopilotChat.slots.e2e.test.tsx +0 -432
  163. package/src/v2/components/chat/__tests__/CopilotChat.suggestionsAlways.test.tsx +0 -183
  164. package/src/v2/components/chat/__tests__/CopilotChat.welcomeGate.test.tsx +0 -184
  165. package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.tsx +0 -649
  166. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.slots.e2e.test.tsx +0 -624
  167. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.test.tsx +0 -702
  168. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.thumbs.test.tsx +0 -72
  169. package/src/v2/components/chat/__tests__/CopilotChatCopyButton.clipboard.test.tsx +0 -241
  170. package/src/v2/components/chat/__tests__/CopilotChatCssClasses.test.tsx +0 -107
  171. package/src/v2/components/chat/__tests__/CopilotChatInput.slots.e2e.test.tsx +0 -929
  172. package/src/v2/components/chat/__tests__/CopilotChatInput.test.tsx +0 -1567
  173. package/src/v2/components/chat/__tests__/CopilotChatMessageView.slots.e2e.test.tsx +0 -1004
  174. package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.tsx +0 -279
  175. package/src/v2/components/chat/__tests__/CopilotChatPerf.e2e.test.tsx +0 -336
  176. package/src/v2/components/chat/__tests__/CopilotChatPropsRerender.e2e.test.tsx +0 -249
  177. package/src/v2/components/chat/__tests__/CopilotChatSuggestionView.slots.e2e.test.tsx +0 -530
  178. package/src/v2/components/chat/__tests__/CopilotChatToolRendering.e2e.test.tsx +0 -785
  179. package/src/v2/components/chat/__tests__/CopilotChatToolRerenders.e2e.test.tsx +0 -2416
  180. package/src/v2/components/chat/__tests__/CopilotChatUserMessage.slots.e2e.test.tsx +0 -621
  181. package/src/v2/components/chat/__tests__/CopilotChatView.connectingGate.test.tsx +0 -56
  182. package/src/v2/components/chat/__tests__/CopilotChatView.inputOverlay.test.tsx +0 -264
  183. package/src/v2/components/chat/__tests__/CopilotChatView.onClick.e2e.test.tsx +0 -853
  184. package/src/v2/components/chat/__tests__/CopilotChatView.pinToSend.test.tsx +0 -94
  185. package/src/v2/components/chat/__tests__/CopilotChatView.slots.e2e.test.tsx +0 -1050
  186. package/src/v2/components/chat/__tests__/CopilotModalHeader.slots.e2e.test.tsx +0 -484
  187. package/src/v2/components/chat/__tests__/CopilotPopupView.slots.e2e.test.tsx +0 -612
  188. package/src/v2/components/chat/__tests__/CopilotSidebarView.position.test.tsx +0 -159
  189. package/src/v2/components/chat/__tests__/CopilotSidebarView.slots.e2e.test.tsx +0 -502
  190. package/src/v2/components/chat/__tests__/MCPAppsActivityRenderer.e2e.test.tsx +0 -1068
  191. package/src/v2/components/chat/__tests__/MCPAppsProxy.e2e.test.tsx +0 -589
  192. package/src/v2/components/chat/__tests__/MCPAppsUiMessage.e2e.test.tsx +0 -403
  193. package/src/v2/components/chat/__tests__/copilot-chat-throttle.test.tsx +0 -137
  194. package/src/v2/components/chat/__tests__/normalize-auto-scroll.test.ts +0 -37
  195. package/src/v2/components/chat/__tests__/setup.ts +0 -1
  196. package/src/v2/components/chat/index.ts +0 -90
  197. package/src/v2/components/chat/last-user-message-context.ts +0 -21
  198. package/src/v2/components/chat/normalize-auto-scroll.ts +0 -17
  199. package/src/v2/components/chat/scroll-element-context.ts +0 -13
  200. package/src/v2/components/index.ts +0 -8
  201. package/src/v2/components/intelligence-indicator/IntelligenceIndicator.tsx +0 -286
  202. package/src/v2/components/intelligence-indicator/__tests__/IntelligenceIndicator.e2e.test.tsx +0 -464
  203. package/src/v2/components/intelligence-indicator/index.ts +0 -2
  204. package/src/v2/components/license-warning-banner.tsx +0 -217
  205. package/src/v2/components/ui/button.tsx +0 -124
  206. package/src/v2/components/ui/dropdown-menu.tsx +0 -258
  207. package/src/v2/components/ui/tooltip.tsx +0 -60
  208. package/src/v2/context.ts +0 -62
  209. package/src/v2/headless.ts +0 -64
  210. package/src/v2/hooks/__tests__/standard-schema-types.test.tsx +0 -152
  211. package/src/v2/hooks/__tests__/standard-schema.test.tsx +0 -282
  212. package/src/v2/hooks/__tests__/use-agent-context-timing.e2e.test.tsx +0 -140
  213. package/src/v2/hooks/__tests__/use-agent-context.test.tsx +0 -401
  214. package/src/v2/hooks/__tests__/use-agent-error-state.test.tsx +0 -44
  215. package/src/v2/hooks/__tests__/use-agent-stability.test.tsx +0 -211
  216. package/src/v2/hooks/__tests__/use-agent-throttle.test.tsx +0 -1029
  217. package/src/v2/hooks/__tests__/use-agent.e2e.test.tsx +0 -159
  218. package/src/v2/hooks/__tests__/use-attachments.test.tsx +0 -169
  219. package/src/v2/hooks/__tests__/use-capabilities.test.tsx +0 -76
  220. package/src/v2/hooks/__tests__/use-component.test.tsx +0 -126
  221. package/src/v2/hooks/__tests__/use-configure-suggestions.e2e.test.tsx +0 -696
  222. package/src/v2/hooks/__tests__/use-default-render-tool.test.tsx +0 -153
  223. package/src/v2/hooks/__tests__/use-frontend-tool-available.test.tsx +0 -167
  224. package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.tsx +0 -2148
  225. package/src/v2/hooks/__tests__/use-human-in-the-loop.e2e.test.tsx +0 -1261
  226. package/src/v2/hooks/__tests__/use-interrupt.test.tsx +0 -397
  227. package/src/v2/hooks/__tests__/use-katex-styles.test.tsx +0 -56
  228. package/src/v2/hooks/__tests__/use-keyboard-height.test.tsx +0 -192
  229. package/src/v2/hooks/__tests__/use-pin-to-send.test.tsx +0 -219
  230. package/src/v2/hooks/__tests__/use-render-custom-messages.test.tsx +0 -55
  231. package/src/v2/hooks/__tests__/use-render-tool.test.tsx +0 -259
  232. package/src/v2/hooks/__tests__/use-suggestions.e2e.test.tsx +0 -524
  233. package/src/v2/hooks/__tests__/use-threads.test.tsx +0 -757
  234. package/src/v2/hooks/__tests__/zod-regression.test.tsx +0 -311
  235. package/src/v2/hooks/index.ts +0 -24
  236. package/src/v2/hooks/use-agent-context.tsx +0 -45
  237. package/src/v2/hooks/use-agent.tsx +0 -227
  238. package/src/v2/hooks/use-attachments.tsx +0 -269
  239. package/src/v2/hooks/use-capabilities.tsx +0 -25
  240. package/src/v2/hooks/use-component.tsx +0 -91
  241. package/src/v2/hooks/use-configure-suggestions.tsx +0 -236
  242. package/src/v2/hooks/use-default-render-tool.tsx +0 -271
  243. package/src/v2/hooks/use-frontend-tool.tsx +0 -46
  244. package/src/v2/hooks/use-human-in-the-loop.tsx +0 -81
  245. package/src/v2/hooks/use-interrupt.tsx +0 -305
  246. package/src/v2/hooks/use-keyboard-height.tsx +0 -67
  247. package/src/v2/hooks/use-pin-to-send.ts +0 -94
  248. package/src/v2/hooks/use-render-activity-message.tsx +0 -72
  249. package/src/v2/hooks/use-render-custom-messages.tsx +0 -93
  250. package/src/v2/hooks/use-render-tool-call.tsx +0 -208
  251. package/src/v2/hooks/use-render-tool.tsx +0 -184
  252. package/src/v2/hooks/use-suggestions.tsx +0 -91
  253. package/src/v2/hooks/use-threads.tsx +0 -325
  254. package/src/v2/hooks/useKatexStyles.ts +0 -27
  255. package/src/v2/index.css +0 -1
  256. package/src/v2/index.ts +0 -27
  257. package/src/v2/lib/__tests__/completePartialMarkdown.test.ts +0 -495
  258. package/src/v2/lib/__tests__/processPartialHtml.test.ts +0 -112
  259. package/src/v2/lib/__tests__/renderSlot.test.tsx +0 -588
  260. package/src/v2/lib/__tests__/slots.test.ts +0 -56
  261. package/src/v2/lib/processPartialHtml.ts +0 -45
  262. package/src/v2/lib/react-core.ts +0 -156
  263. package/src/v2/lib/slots.tsx +0 -184
  264. package/src/v2/lib/transcription-client.ts +0 -184
  265. package/src/v2/lib/utils.ts +0 -8
  266. package/src/v2/providers/CopilotChatConfigurationProvider.tsx +0 -196
  267. package/src/v2/providers/CopilotKitProvider.tsx +0 -800
  268. package/src/v2/providers/SandboxFunctionsContext.ts +0 -10
  269. package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.test.tsx +0 -652
  270. package/src/v2/providers/__tests__/CopilotKitProvider.license.test.tsx +0 -101
  271. package/src/v2/providers/__tests__/CopilotKitProvider.onError.test.tsx +0 -69
  272. package/src/v2/providers/__tests__/CopilotKitProvider.renderCustomMessages.e2e.test.tsx +0 -881
  273. package/src/v2/providers/__tests__/CopilotKitProvider.sandboxFunctions.test.tsx +0 -198
  274. package/src/v2/providers/__tests__/CopilotKitProvider.stability.test.tsx +0 -740
  275. package/src/v2/providers/__tests__/CopilotKitProvider.test.tsx +0 -713
  276. package/src/v2/providers/__tests__/CopilotKitProvider.wildcard.test.tsx +0 -294
  277. package/src/v2/providers/index.ts +0 -21
  278. package/src/v2/styles/globals.css +0 -349
  279. package/src/v2/types/__tests__/defineToolCallRenderer.test.tsx +0 -525
  280. package/src/v2/types/defineToolCallRenderer.ts +0 -68
  281. package/src/v2/types/frontend-tool.ts +0 -8
  282. package/src/v2/types/human-in-the-loop.ts +0 -33
  283. package/src/v2/types/index.ts +0 -8
  284. package/src/v2/types/interrupt.ts +0 -15
  285. package/src/v2/types/react-activity-message-renderer.ts +0 -27
  286. package/src/v2/types/react-custom-message-renderer.ts +0 -17
  287. package/src/v2/types/react-tool-call-renderer.ts +0 -35
  288. package/src/v2/types/sandbox-function.ts +0 -11
  289. package/tsconfig.json +0 -8
  290. package/tsdown.config.ts +0 -193
  291. package/typedoc.json +0 -4
  292. package/vitest.config.mjs +0 -31
@@ -1,1016 +0,0 @@
1
- "use client";
2
-
3
- import { useCopilotContext } from "../../context/copilot-context";
4
- import { useCopilotMessagesContext } from "../../context/copilot-messages-context";
5
- import { COPILOTKIT_VERSION } from "@copilotkit/shared";
6
- import { useEffect, useState } from "react";
7
- import {
8
- CheckIcon,
9
- CopilotKitIcon,
10
- ExclamationMarkTriangleIcon,
11
- } from "./icons";
12
-
13
- // Type definitions for the developer console
14
- interface ActionParameter {
15
- name: string;
16
- required?: boolean;
17
- type?: string;
18
- }
19
-
20
- interface Action {
21
- name: string;
22
- description?: string;
23
- parameters?: ActionParameter[];
24
- status?: string;
25
- }
26
-
27
- interface Readable {
28
- name?: string;
29
- description?: string;
30
- value?: any;
31
- content?: string;
32
- metadata?: Record<string, any>;
33
- }
34
-
35
- interface AgentState {
36
- status?: string;
37
- state?: any;
38
- running?: boolean;
39
- lastUpdate?: number;
40
- }
41
-
42
- interface Message {
43
- id?: string;
44
- role?: "user" | "assistant" | "system";
45
- content?: string;
46
- timestamp?: number;
47
- [key: string]: any; // Allow additional properties from CopilotKit
48
- }
49
-
50
- interface Document {
51
- name?: string;
52
- content?: string;
53
- metadata?: Record<string, any>;
54
- }
55
-
56
- interface DisplayContext {
57
- actions: Record<string, Action>;
58
- getAllContext: () => Readable[];
59
- coagentStates: Record<string, AgentState>;
60
- getDocumentsContext: (args?: any[]) => Document[];
61
- }
62
-
63
- interface MessagesContext {
64
- messages: Message[];
65
- }
66
-
67
- interface DeveloperConsoleModalProps {
68
- isOpen: boolean;
69
- onClose: () => void;
70
- hasApiKey: boolean;
71
- }
72
-
73
- export function DeveloperConsoleModal({
74
- isOpen,
75
- onClose,
76
- hasApiKey,
77
- }: DeveloperConsoleModalProps) {
78
- const context = useCopilotContext();
79
- const messagesContext = useCopilotMessagesContext();
80
- const [activeTab, setActiveTab] = useState("actions");
81
-
82
- // Handle escape key
83
- useEffect(() => {
84
- const handleEscape = (e: KeyboardEvent) => {
85
- if (e.key === "Escape") {
86
- onClose();
87
- }
88
- };
89
-
90
- if (isOpen) {
91
- document.addEventListener("keydown", handleEscape);
92
- document.body.style.overflow = "hidden";
93
- }
94
-
95
- return () => {
96
- document.removeEventListener("keydown", handleEscape);
97
- document.body.style.overflow = "unset";
98
- };
99
- }, [isOpen, onClose]);
100
-
101
- if (!isOpen) return null;
102
-
103
- // Create mock data for preview when no API key
104
- const displayContext: DisplayContext = hasApiKey
105
- ? (context as DisplayContext)
106
- : {
107
- actions: {
108
- search_web: {
109
- name: "search_web",
110
- description: "Search the web for information",
111
- },
112
- send_email: {
113
- name: "send_email",
114
- description: "Send an email to a contact",
115
- },
116
- create_document: {
117
- name: "create_document",
118
- description: "Create a new document",
119
- },
120
- analyze_code: {
121
- name: "analyze_code",
122
- description: "Analyze code for issues and improvements",
123
- },
124
- generate_tests: {
125
- name: "generate_tests",
126
- description: "Generate unit tests for functions",
127
- },
128
- },
129
- getAllContext: () => [
130
- {
131
- content:
132
- "User preferences: dark mode enabled, TypeScript preferred",
133
- metadata: { source: "settings" },
134
- },
135
- {
136
- content:
137
- "Current project: Building a React application with CopilotKit",
138
- metadata: { source: "project" },
139
- },
140
- {
141
- content: "Recent activity: Implemented authentication system",
142
- metadata: { source: "activity" },
143
- },
144
- {
145
- content: "Development environment: VS Code, Node.js 18, React 18",
146
- metadata: { source: "environment" },
147
- },
148
- ],
149
- coagentStates: {
150
- "main-agent": { status: "active", lastUpdate: Date.now() },
151
- "code-assistant": {
152
- status: "active",
153
- lastUpdate: Date.now() - 15000,
154
- },
155
- "search-agent": { status: "idle", lastUpdate: Date.now() - 60000 },
156
- },
157
- getDocumentsContext: () => [
158
- {
159
- content: "README.md: Project setup and installation instructions",
160
- metadata: { type: "documentation" },
161
- },
162
- {
163
- content: "API Documentation: CopilotKit integration guide",
164
- metadata: { type: "documentation" },
165
- },
166
- {
167
- content: "package.json: Project dependencies and scripts",
168
- metadata: { type: "configuration" },
169
- },
170
- ],
171
- };
172
-
173
- const displayMessagesContext: MessagesContext = hasApiKey
174
- ? (messagesContext as MessagesContext)
175
- : {
176
- messages: [
177
- {
178
- id: "1",
179
- role: "user",
180
- content:
181
- "Help me implement a todo list with drag and drop functionality",
182
- },
183
- {
184
- id: "2",
185
- role: "assistant",
186
- content:
187
- "I'll help you create a todo list with drag and drop. Let me start by setting up the basic components and then add the drag and drop functionality using React DnD.",
188
- },
189
- {
190
- id: "3",
191
- role: "user",
192
- content: "Can you also add priority levels and due dates?",
193
- },
194
- {
195
- id: "4",
196
- role: "assistant",
197
- content:
198
- "Absolutely! I'll enhance the todo items with priority levels (high, medium, low) and due date functionality. This will make your todo list much more powerful for task management.",
199
- },
200
- {
201
- id: "5",
202
- role: "user",
203
- content: "Perfect! How about adding categories or tags?",
204
- },
205
- ],
206
- };
207
-
208
- return (
209
- <div
210
- style={{
211
- position: "fixed",
212
- top: 0,
213
- left: 0,
214
- right: 0,
215
- bottom: 0,
216
- zIndex: 9999,
217
- backgroundColor: "rgba(0, 0, 0, 0.3)",
218
- display: "flex",
219
- alignItems: "center",
220
- justifyContent: "center",
221
- padding: "16px",
222
- }}
223
- onClick={onClose}
224
- >
225
- <div
226
- style={{
227
- width: "1152px",
228
- maxWidth: "95vw",
229
- height: "80vh",
230
- backgroundColor: "white",
231
- borderRadius: "12px",
232
- boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
233
- display: "flex",
234
- flexDirection: "column",
235
- overflow: "hidden",
236
- position: "relative",
237
- }}
238
- onClick={(e) => e.stopPropagation()}
239
- >
240
- {/* Header */}
241
- <div
242
- style={{
243
- display: "flex",
244
- alignItems: "center",
245
- justifyContent: "space-between",
246
- padding: "24px",
247
- borderBottom: "1px solid #e5e7eb",
248
- minHeight: "73px",
249
- flexShrink: 0,
250
- filter: !hasApiKey ? "blur(0.3px)" : "none",
251
- opacity: !hasApiKey ? 0.95 : 1,
252
- }}
253
- >
254
- <div style={{ display: "flex", alignItems: "center", gap: "12px" }}>
255
- <CopilotKitIcon />
256
- <h1
257
- style={{
258
- fontWeight: "bold",
259
- fontSize: "20px",
260
- color: "#1f2937",
261
- margin: 0,
262
- }}
263
- >
264
- Inspector
265
- </h1>
266
- <span
267
- style={{
268
- fontSize: "14px",
269
- color: "#6b7280",
270
- backgroundColor: "#f3f4f6",
271
- padding: "4px 8px",
272
- borderRadius: "4px",
273
- }}
274
- >
275
- v{COPILOTKIT_VERSION}
276
- </span>
277
- </div>
278
- <button
279
- onClick={onClose}
280
- style={{
281
- color: "#9ca3af",
282
- fontSize: "24px",
283
- fontWeight: "300",
284
- border: "none",
285
- background: "none",
286
- cursor: "pointer",
287
- padding: "4px",
288
- }}
289
- onMouseEnter={(e) => (e.currentTarget.style.color = "#4b5563")}
290
- onMouseLeave={(e) => (e.currentTarget.style.color = "#9ca3af")}
291
- >
292
- ×
293
- </button>
294
- </div>
295
-
296
- {/* Tab Navigation */}
297
- <div
298
- style={{
299
- display: "flex",
300
- borderBottom: "1px solid #e5e7eb",
301
- backgroundColor: "#f9fafb",
302
- minHeight: "50px",
303
- flexShrink: 0,
304
- filter: !hasApiKey ? "blur(0.3px)" : "none",
305
- opacity: !hasApiKey ? 0.9 : 1,
306
- }}
307
- >
308
- {[
309
- {
310
- id: "actions",
311
- label: "Actions",
312
- count: Object.keys(displayContext.actions).length,
313
- },
314
- {
315
- id: "readables",
316
- label: "Readables",
317
- count: displayContext.getAllContext().length,
318
- },
319
- {
320
- id: "agent",
321
- label: "Agent Status",
322
- count: Object.keys(displayContext.coagentStates).length,
323
- },
324
- {
325
- id: "messages",
326
- label: "Messages",
327
- count: displayMessagesContext.messages.length,
328
- },
329
- {
330
- id: "context",
331
- label: "Context",
332
- count: displayContext.getDocumentsContext([]).length,
333
- },
334
- ].map((tab) => (
335
- <button
336
- key={tab.id}
337
- onClick={() => setActiveTab(tab.id)}
338
- style={{
339
- padding: "12px 24px",
340
- fontSize: "14px",
341
- fontWeight: "500",
342
- border: "none",
343
- cursor: "pointer",
344
- backgroundColor: activeTab === tab.id ? "white" : "transparent",
345
- color: activeTab === tab.id ? "#2563eb" : "#6b7280",
346
- borderBottom:
347
- activeTab === tab.id ? "2px solid #2563eb" : "none",
348
- transition: "all 0.2s",
349
- }}
350
- onMouseEnter={(e) => {
351
- if (activeTab !== tab.id) {
352
- e.currentTarget.style.color = "#1f2937";
353
- e.currentTarget.style.backgroundColor = "#f3f4f6";
354
- }
355
- }}
356
- onMouseLeave={(e) => {
357
- if (activeTab !== tab.id) {
358
- e.currentTarget.style.color = "#6b7280";
359
- e.currentTarget.style.backgroundColor = "transparent";
360
- }
361
- }}
362
- >
363
- {tab.label}
364
- {tab.count > 0 && (
365
- <span
366
- style={{
367
- marginLeft: "8px",
368
- backgroundColor: "#e5e7eb",
369
- color: "#374151",
370
- padding: "2px 8px",
371
- borderRadius: "9999px",
372
- fontSize: "12px",
373
- }}
374
- >
375
- {tab.count}
376
- </span>
377
- )}
378
- </button>
379
- ))}
380
- </div>
381
-
382
- {/* Content */}
383
- <div
384
- style={{
385
- height: "calc(100% - 142px)",
386
- overflow: "auto",
387
- padding: "24px",
388
- backgroundColor: "#f9fafb",
389
- filter: !hasApiKey ? "blur(0.3px)" : "none",
390
- opacity: !hasApiKey ? 0.85 : 1,
391
- }}
392
- >
393
- {activeTab === "actions" && <ActionsTab context={displayContext} />}
394
- {activeTab === "readables" && (
395
- <ReadablesTab context={displayContext} />
396
- )}
397
- {activeTab === "agent" && <AgentStatusTab context={displayContext} />}
398
- {activeTab === "messages" && (
399
- <MessagesTab messagesContext={displayMessagesContext} />
400
- )}
401
- {activeTab === "context" && <ContextTab context={displayContext} />}
402
- </div>
403
-
404
- {/* Footer */}
405
- <div
406
- style={{
407
- padding: "16px 24px",
408
- borderTop: "1px solid #e5e7eb",
409
- backgroundColor: "white",
410
- display: "flex",
411
- justifyContent: "space-between",
412
- alignItems: "center",
413
- minHeight: "57px",
414
- flexShrink: 0,
415
- filter: !hasApiKey ? "blur(0.3px)" : "none",
416
- opacity: !hasApiKey ? 0.9 : 1,
417
- }}
418
- >
419
- <div style={{ fontSize: "14px", color: "#6b7280" }}>
420
- <a
421
- href="https://github.com/CopilotKit/CopilotKit/issues"
422
- target="_blank"
423
- rel="noopener noreferrer"
424
- style={{ color: "#2563eb", textDecoration: "none" }}
425
- onMouseEnter={(e) =>
426
- (e.currentTarget.style.textDecoration = "underline")
427
- }
428
- onMouseLeave={(e) =>
429
- (e.currentTarget.style.textDecoration = "none")
430
- }
431
- >
432
- Report an issue
433
- </a>
434
- </div>
435
- <div style={{ fontSize: "14px", color: "#6b7280" }}>
436
- <a
437
- href="https://mcp.copilotkit.ai/"
438
- target="_blank"
439
- rel="noopener noreferrer"
440
- style={{ color: "#2563eb", textDecoration: "none" }}
441
- onMouseEnter={(e) =>
442
- (e.currentTarget.style.textDecoration = "underline")
443
- }
444
- onMouseLeave={(e) =>
445
- (e.currentTarget.style.textDecoration = "none")
446
- }
447
- >
448
- Add MCP Server →
449
- </a>
450
- </div>
451
- </div>
452
-
453
- {/* Enhanced CTA Overlay */}
454
- {!hasApiKey && (
455
- <div
456
- style={{
457
- position: "absolute",
458
- top: 0,
459
- left: 0,
460
- right: 0,
461
- bottom: 0,
462
- backgroundColor: "rgba(255, 255, 255, 0.2)",
463
- backdropFilter: "blur(2px)",
464
- WebkitBackdropFilter: "blur(2px)",
465
- display: "flex",
466
- alignItems: "center",
467
- justifyContent: "center",
468
- borderRadius: "12px",
469
- zIndex: 10,
470
- }}
471
- onClick={(e) => e.stopPropagation()}
472
- >
473
- <button
474
- onClick={() =>
475
- window.open("https://cloud.copilotkit.ai/sign-in", "_blank")
476
- }
477
- style={{
478
- // Following button system specifications
479
- height: "48px",
480
- padding: "12px 24px",
481
- backgroundColor: "#030507", // textPrimary token
482
- color: "#FFFFFF",
483
- borderRadius: "12px", // Medium radius token
484
- border: "none",
485
- cursor: "pointer",
486
- fontSize: "14px", // Medium Semi Bold typography
487
- fontWeight: "600",
488
- fontFamily:
489
- "'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif",
490
- lineHeight: "22px",
491
- boxShadow:
492
- "0 4px 16px rgba(3, 5, 7, 0.2), 0 1px 3px rgba(3, 5, 7, 0.1)",
493
- transition: "all 200ms ease", // 200ms ease as per specs
494
- display: "inline-flex",
495
- alignItems: "center",
496
- gap: "8px",
497
- textTransform: "uppercase",
498
- letterSpacing: "0.5px",
499
- }}
500
- onMouseEnter={(e) => {
501
- e.currentTarget.style.backgroundColor = "#575758"; // textSecondary token for hover
502
- e.currentTarget.style.transform = "translateY(-1px)";
503
- e.currentTarget.style.boxShadow =
504
- "0 6px 20px rgba(3, 5, 7, 0.25), 0 2px 4px rgba(3, 5, 7, 0.15)";
505
- }}
506
- onMouseLeave={(e) => {
507
- e.currentTarget.style.backgroundColor = "#030507";
508
- e.currentTarget.style.transform = "translateY(0)";
509
- e.currentTarget.style.boxShadow =
510
- "0 4px 16px rgba(3, 5, 7, 0.2), 0 1px 3px rgba(3, 5, 7, 0.1)";
511
- }}
512
- onMouseDown={(e) => {
513
- e.currentTarget.style.backgroundColor = "#858589"; // textDisabled token for pressed
514
- e.currentTarget.style.transform = "translateY(0)";
515
- }}
516
- onMouseUp={(e) => {
517
- e.currentTarget.style.backgroundColor = "#575758";
518
- e.currentTarget.style.transform = "translateY(-1px)";
519
- }}
520
- onFocus={(e) => {
521
- e.currentTarget.style.outline = "2px solid #BEC9FF";
522
- e.currentTarget.style.outlineOffset = "2px";
523
- }}
524
- onBlur={(e) => {
525
- e.currentTarget.style.outline = "none";
526
- }}
527
- >
528
- Get License Key
529
- <span style={{ fontSize: "16px", marginLeft: "-4px" }}>→</span>
530
- </button>
531
- </div>
532
- )}
533
- </div>
534
- </div>
535
- );
536
- }
537
-
538
- // Tab Components
539
- function ActionsTab({ context }: { context: DisplayContext }) {
540
- const actions = Object.values(context.actions);
541
-
542
- if (actions.length === 0) {
543
- return (
544
- <div style={{ textAlign: "center", padding: "48px 0", color: "#6b7280" }}>
545
- <p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>
546
- No actions available
547
- </p>
548
- <p style={{ fontSize: "14px", margin: 0 }}>
549
- Actions will appear here when registered
550
- </p>
551
- </div>
552
- );
553
- }
554
-
555
- return (
556
- <div style={{ display: "flex", flexDirection: "column", gap: "16px" }}>
557
- {actions.map((action: Action, index: number) => (
558
- <div
559
- key={index}
560
- style={{
561
- backgroundColor: "white",
562
- padding: "16px",
563
- borderRadius: "8px",
564
- boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1)",
565
- border: "1px solid #e5e7eb",
566
- }}
567
- >
568
- <div
569
- style={{
570
- display: "flex",
571
- alignItems: "flex-start",
572
- justifyContent: "space-between",
573
- }}
574
- >
575
- <div style={{ flex: 1 }}>
576
- <h3
577
- style={{
578
- fontWeight: "600",
579
- color: "#1f2937",
580
- margin: "0 0 4px 0",
581
- }}
582
- >
583
- {action.name}
584
- </h3>
585
- {action.description && (
586
- <p
587
- style={{
588
- fontSize: "14px",
589
- color: "#4b5563",
590
- margin: "0 0 12px 0",
591
- }}
592
- >
593
- {action.description}
594
- </p>
595
- )}
596
- {action.parameters && action.parameters.length > 0 && (
597
- <div style={{ marginTop: "12px" }}>
598
- <p
599
- style={{
600
- fontSize: "12px",
601
- fontWeight: "500",
602
- color: "#6b7280",
603
- textTransform: "uppercase",
604
- margin: "0 0 4px 0",
605
- }}
606
- >
607
- Parameters:
608
- </p>
609
- <div
610
- style={{
611
- display: "flex",
612
- flexDirection: "column",
613
- gap: "4px",
614
- }}
615
- >
616
- {action.parameters.map(
617
- (param: ActionParameter, pIndex: number) => (
618
- <div key={pIndex} style={{ fontSize: "14px" }}>
619
- <span
620
- style={{
621
- fontFamily: "monospace",
622
- color: "#374151",
623
- }}
624
- >
625
- {param.name}
626
- </span>
627
- {param.required && (
628
- <span
629
- style={{
630
- marginLeft: "4px",
631
- fontSize: "12px",
632
- color: "#ef4444",
633
- }}
634
- >
635
- *required
636
- </span>
637
- )}
638
- {param.type && (
639
- <span
640
- style={{
641
- marginLeft: "8px",
642
- fontSize: "12px",
643
- color: "#6b7280",
644
- }}
645
- >
646
- ({param.type})
647
- </span>
648
- )}
649
- </div>
650
- ),
651
- )}
652
- </div>
653
- </div>
654
- )}
655
- </div>
656
- <div style={{ marginLeft: "16px" }}>
657
- {action.status === "available" ? (
658
- <CheckIcon />
659
- ) : (
660
- <ExclamationMarkTriangleIcon />
661
- )}
662
- </div>
663
- </div>
664
- </div>
665
- ))}
666
- </div>
667
- );
668
- }
669
-
670
- function ReadablesTab({ context }: { context: DisplayContext }) {
671
- const readables = context.getAllContext();
672
-
673
- if (readables.length === 0) {
674
- return (
675
- <div style={{ textAlign: "center", padding: "48px 0", color: "#6b7280" }}>
676
- <p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>
677
- No readable context available
678
- </p>
679
- <p style={{ fontSize: "14px", margin: 0 }}>
680
- Readable context will appear here when provided
681
- </p>
682
- </div>
683
- );
684
- }
685
-
686
- return (
687
- <div style={{ display: "flex", flexDirection: "column", gap: "16px" }}>
688
- {readables.map((readable: Readable, index: number) => (
689
- <div
690
- key={index}
691
- style={{
692
- backgroundColor: "white",
693
- padding: "16px",
694
- borderRadius: "8px",
695
- boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1)",
696
- border: "1px solid #e5e7eb",
697
- }}
698
- >
699
- <div
700
- style={{
701
- display: "flex",
702
- alignItems: "flex-start",
703
- justifyContent: "space-between",
704
- }}
705
- >
706
- <div style={{ flex: 1 }}>
707
- <h3
708
- style={{
709
- fontWeight: "600",
710
- color: "#1f2937",
711
- margin: "0 0 4px 0",
712
- }}
713
- >
714
- {readable.name || `Readable ${index + 1}`}
715
- </h3>
716
- {readable.description && (
717
- <p
718
- style={{
719
- fontSize: "14px",
720
- color: "#4b5563",
721
- margin: "0 0 12px 0",
722
- }}
723
- >
724
- {readable.description}
725
- </p>
726
- )}
727
- {readable.value && (
728
- <pre
729
- style={{
730
- marginTop: "12px",
731
- padding: "8px",
732
- backgroundColor: "#f9fafb",
733
- borderRadius: "4px",
734
- fontSize: "12px",
735
- overflowX: "auto",
736
- margin: "12px 0 0 0",
737
- }}
738
- >
739
- {JSON.stringify(readable.value, null, 2)}
740
- </pre>
741
- )}
742
- </div>
743
- </div>
744
- </div>
745
- ))}
746
- </div>
747
- );
748
- }
749
-
750
- function AgentStatusTab({ context }: { context: DisplayContext }) {
751
- const agentStates = context.coagentStates || {};
752
- const agentStateEntries = Object.entries(agentStates);
753
-
754
- if (agentStateEntries.length === 0) {
755
- return (
756
- <div style={{ textAlign: "center", padding: "48px 0", color: "#6b7280" }}>
757
- <p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>
758
- No agent states available
759
- </p>
760
- <p style={{ fontSize: "14px", margin: 0 }}>
761
- Agent states will appear here when agents are active
762
- </p>
763
- </div>
764
- );
765
- }
766
-
767
- return (
768
- <div style={{ display: "flex", flexDirection: "column", gap: "24px" }}>
769
- {agentStateEntries.map(([agentName, state]: [string, AgentState]) => (
770
- <div
771
- key={agentName}
772
- style={{
773
- backgroundColor: "white",
774
- padding: "24px",
775
- borderRadius: "8px",
776
- boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1)",
777
- border: "1px solid #e5e7eb",
778
- }}
779
- >
780
- <div
781
- style={{
782
- display: "flex",
783
- alignItems: "center",
784
- justifyContent: "space-between",
785
- marginBottom: "16px",
786
- }}
787
- >
788
- <h3
789
- style={{
790
- fontWeight: "600",
791
- fontSize: "18px",
792
- color: "#1f2937",
793
- margin: 0,
794
- }}
795
- >
796
- {agentName}
797
- </h3>
798
- <span
799
- style={{
800
- padding: "4px 12px",
801
- borderRadius: "9999px",
802
- fontSize: "12px",
803
- fontWeight: "500",
804
- backgroundColor:
805
- state.status === "running"
806
- ? "#dcfce7"
807
- : state.status === "complete"
808
- ? "#dbeafe"
809
- : "#f3f4f6",
810
- color:
811
- state.status === "running"
812
- ? "#166534"
813
- : state.status === "complete"
814
- ? "#1e40af"
815
- : "#1f2937",
816
- }}
817
- >
818
- {state.status || "idle"}
819
- </span>
820
- </div>
821
-
822
- {state.state && (
823
- <div style={{ marginBottom: "12px" }}>
824
- <p
825
- style={{
826
- fontSize: "12px",
827
- fontWeight: "500",
828
- color: "#6b7280",
829
- textTransform: "uppercase",
830
- margin: "0 0 4px 0",
831
- }}
832
- >
833
- Current State:
834
- </p>
835
- <pre
836
- style={{
837
- padding: "12px",
838
- backgroundColor: "#f9fafb",
839
- borderRadius: "4px",
840
- fontSize: "12px",
841
- overflowX: "auto",
842
- margin: 0,
843
- }}
844
- >
845
- {JSON.stringify(state.state, null, 2)}
846
- </pre>
847
- </div>
848
- )}
849
-
850
- {state.running && (
851
- <div
852
- style={{
853
- marginTop: "16px",
854
- display: "flex",
855
- alignItems: "center",
856
- fontSize: "14px",
857
- color: "#4b5563",
858
- }}
859
- >
860
- <div style={{ marginRight: "8px" }}>
861
- <svg
862
- width="16"
863
- height="16"
864
- viewBox="0 0 16 16"
865
- style={{ animation: "spin 1s linear infinite" }}
866
- >
867
- <style>{`@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }`}</style>
868
- <circle
869
- cx="8"
870
- cy="8"
871
- r="6"
872
- fill="none"
873
- stroke="#4b5563"
874
- strokeWidth="2"
875
- strokeDasharray="9 3"
876
- />
877
- </svg>
878
- </div>
879
- <span>Agent is currently running...</span>
880
- </div>
881
- )}
882
- </div>
883
- ))}
884
- </div>
885
- );
886
- }
887
-
888
- function MessagesTab({
889
- messagesContext,
890
- }: {
891
- messagesContext: MessagesContext;
892
- }) {
893
- const messages = messagesContext.messages || [];
894
-
895
- if (messages.length === 0) {
896
- return (
897
- <div style={{ textAlign: "center", padding: "48px 0", color: "#6b7280" }}>
898
- <p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>No messages yet</p>
899
- <p style={{ fontSize: "14px", margin: 0 }}>
900
- Messages will appear here as the conversation progresses
901
- </p>
902
- </div>
903
- );
904
- }
905
-
906
- return (
907
- <div style={{ display: "flex", flexDirection: "column", gap: "16px" }}>
908
- {messages.map((message: Message, index: number) => (
909
- <div
910
- key={index}
911
- style={{
912
- padding: "16px",
913
- borderRadius: "8px",
914
- backgroundColor:
915
- message.role === "user"
916
- ? "#eff6ff"
917
- : message.role === "assistant"
918
- ? "#f9fafb"
919
- : "#fefce8",
920
- border: `1px solid ${message.role === "user" ? "#c7d2fe" : message.role === "assistant" ? "#e5e7eb" : "#fde047"}`,
921
- marginLeft: message.role === "user" ? "48px" : "0",
922
- marginRight: message.role === "assistant" ? "48px" : "0",
923
- }}
924
- >
925
- <div
926
- style={{
927
- display: "flex",
928
- alignItems: "flex-start",
929
- justifyContent: "space-between",
930
- marginBottom: "8px",
931
- }}
932
- >
933
- <span
934
- style={{
935
- fontWeight: "500",
936
- fontSize: "14px",
937
- color: "#374151",
938
- textTransform: "capitalize",
939
- }}
940
- >
941
- {message.role || "system"}
942
- </span>
943
- {message.timestamp && (
944
- <span style={{ fontSize: "12px", color: "#6b7280" }}>
945
- {new Date(message.timestamp).toLocaleTimeString()}
946
- </span>
947
- )}
948
- </div>
949
- <div
950
- style={{
951
- fontSize: "14px",
952
- color: "#1f2937",
953
- whiteSpace: "pre-wrap",
954
- }}
955
- >
956
- {message.content || ""}
957
- </div>
958
- </div>
959
- ))}
960
- </div>
961
- );
962
- }
963
-
964
- function ContextTab({ context }: { context: DisplayContext }) {
965
- const documents = context.getDocumentsContext([]);
966
-
967
- if (documents.length === 0) {
968
- return (
969
- <div style={{ textAlign: "center", padding: "48px 0", color: "#6b7280" }}>
970
- <p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>
971
- No document context available
972
- </p>
973
- <p style={{ fontSize: "14px", margin: 0 }}>
974
- Document context will appear here when provided
975
- </p>
976
- </div>
977
- );
978
- }
979
-
980
- return (
981
- <div style={{ display: "flex", flexDirection: "column", gap: "16px" }}>
982
- {documents.map((doc: Document, index: number) => (
983
- <div
984
- key={index}
985
- style={{
986
- backgroundColor: "white",
987
- padding: "16px",
988
- borderRadius: "8px",
989
- boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1)",
990
- border: "1px solid #e5e7eb",
991
- }}
992
- >
993
- <h3
994
- style={{ fontWeight: "600", color: "#1f2937", margin: "0 0 8px 0" }}
995
- >
996
- {doc.name || `Document ${index + 1}`}
997
- </h3>
998
- {doc.content && (
999
- <pre
1000
- style={{
1001
- padding: "12px",
1002
- backgroundColor: "#f9fafb",
1003
- borderRadius: "4px",
1004
- fontSize: "12px",
1005
- overflowX: "auto",
1006
- margin: 0,
1007
- }}
1008
- >
1009
- {doc.content}
1010
- </pre>
1011
- )}
1012
- </div>
1013
- ))}
1014
- </div>
1015
- );
1016
- }