@copilotkit/react-core 1.57.3 → 1.58.0

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 (282) hide show
  1. package/LICENSE +21 -0
  2. package/dist/{copilotkit-CC8DjOiC.mjs → copilotkit-BIn7HE8f.mjs} +2 -2
  3. package/dist/{copilotkit-CC8DjOiC.mjs.map → copilotkit-BIn7HE8f.mjs.map} +1 -1
  4. package/dist/{copilotkit-CtXcs1ea.cjs → copilotkit-Drw-g6zA.cjs} +2 -2
  5. package/dist/{copilotkit-CtXcs1ea.cjs.map → copilotkit-Drw-g6zA.cjs.map} +1 -1
  6. package/dist/index.cjs +3 -77
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.cts +2 -2
  9. package/dist/index.d.mts +2 -2
  10. package/dist/index.mjs +3 -77
  11. package/dist/index.mjs.map +1 -1
  12. package/dist/index.umd.js +3 -77
  13. package/dist/index.umd.js.map +1 -1
  14. package/dist/v2/index.cjs +1 -1
  15. package/dist/v2/index.mjs +1 -1
  16. package/dist/v2/index.umd.js +1 -1
  17. package/dist/v2/index.umd.js.map +1 -1
  18. package/package.json +12 -13
  19. package/skills/react-core/SKILL.md +108 -0
  20. package/skills/react-core/references/agent-access.md +288 -0
  21. package/skills/react-core/references/attachments.md +291 -0
  22. package/skills/react-core/references/capabilities.md +138 -0
  23. package/skills/react-core/references/chat-components.md +221 -0
  24. package/skills/react-core/references/client-side-tools.md +358 -0
  25. package/skills/react-core/references/custom-message-renderers.md +226 -0
  26. package/skills/react-core/references/debug-mode.md +153 -0
  27. package/skills/react-core/references/human-in-the-loop.md +312 -0
  28. package/skills/react-core/references/provider-setup.md +326 -0
  29. package/skills/react-core/references/rendering-activity-messages.md +207 -0
  30. package/skills/react-core/references/rendering-tool-calls.md +319 -0
  31. package/skills/react-core/references/suggestions.md +211 -0
  32. package/skills/react-core/references/switching-agents-recipes.md +160 -0
  33. package/skills/react-core/references/switching-agents.md +231 -0
  34. package/skills/react-core/references/threads.md +226 -0
  35. package/.attw.json +0 -3
  36. package/CHANGELOG.md +0 -5043
  37. package/scripts/scope-preflight.mjs +0 -100
  38. package/src/components/CopilotListeners.tsx +0 -137
  39. package/src/components/__tests__/CopilotListeners.test.tsx +0 -38
  40. package/src/components/copilot-provider/__tests__/copilot-messages-key.test.tsx +0 -92
  41. package/src/components/copilot-provider/__tests__/copilotkit-error.test.tsx +0 -77
  42. package/src/components/copilot-provider/__tests__/error-visibility-prod.test.tsx +0 -70
  43. package/src/components/copilot-provider/__tests__/v1-explicit-threadid-bridge.test.tsx +0 -107
  44. package/src/components/copilot-provider/copilot-messages.tsx +0 -314
  45. package/src/components/copilot-provider/copilotkit-props.tsx +0 -214
  46. package/src/components/copilot-provider/copilotkit.tsx +0 -853
  47. package/src/components/copilot-provider/index.ts +0 -3
  48. package/src/components/dev-console/console-trigger.tsx +0 -283
  49. package/src/components/dev-console/developer-console-modal.tsx +0 -1016
  50. package/src/components/dev-console/icons.tsx +0 -106
  51. package/src/components/error-boundary/error-boundary.tsx +0 -99
  52. package/src/components/error-boundary/error-utils.tsx +0 -105
  53. package/src/components/index.ts +0 -1
  54. package/src/components/toast/exclamation-mark-icon.tsx +0 -27
  55. package/src/components/toast/toast-provider.tsx +0 -448
  56. package/src/components/usage-banner.tsx +0 -266
  57. package/src/context/__tests__/threads-context.test.tsx +0 -141
  58. package/src/context/coagent-state-renders-context.tsx +0 -89
  59. package/src/context/copilot-context.tsx +0 -365
  60. package/src/context/copilot-messages-context.tsx +0 -35
  61. package/src/context/index.ts +0 -22
  62. package/src/context/threads-context.tsx +0 -69
  63. package/src/hooks/__tests__/use-coagent-config.test.ts +0 -352
  64. package/src/hooks/__tests__/use-coagent-state-render-bridge.helpers.test.ts +0 -107
  65. package/src/hooks/__tests__/use-coagent-state-render.e2e.test.tsx +0 -1209
  66. package/src/hooks/__tests__/use-coagent-state-render.test.tsx +0 -356
  67. package/src/hooks/__tests__/use-copilot-chat-internal-connect.test.tsx +0 -241
  68. package/src/hooks/__tests__/use-frontend-tool-available.test.tsx +0 -72
  69. package/src/hooks/__tests__/use-frontend-tool-remount.e2e.test.tsx +0 -102
  70. package/src/hooks/index.ts +0 -33
  71. package/src/hooks/use-agent-nodename.ts +0 -33
  72. package/src/hooks/use-coagent-state-render-bridge.helpers.ts +0 -345
  73. package/src/hooks/use-coagent-state-render-bridge.tsx +0 -222
  74. package/src/hooks/use-coagent-state-render-registry.ts +0 -230
  75. package/src/hooks/use-coagent-state-render.ts +0 -163
  76. package/src/hooks/use-coagent.ts +0 -377
  77. package/src/hooks/use-configure-chat-suggestions.tsx +0 -96
  78. package/src/hooks/use-copilot-action.ts +0 -245
  79. package/src/hooks/use-copilot-additional-instructions.ts +0 -98
  80. package/src/hooks/use-copilot-authenticated-action.ts +0 -73
  81. package/src/hooks/use-copilot-chat-headless_c.ts +0 -264
  82. package/src/hooks/use-copilot-chat-suggestions.tsx +0 -134
  83. package/src/hooks/use-copilot-chat.ts +0 -132
  84. package/src/hooks/use-copilot-chat_internal.ts +0 -875
  85. package/src/hooks/use-copilot-readable.ts +0 -135
  86. package/src/hooks/use-copilot-runtime-client.ts +0 -178
  87. package/src/hooks/use-default-tool.ts +0 -13
  88. package/src/hooks/use-flat-category-store.ts +0 -109
  89. package/src/hooks/use-frontend-tool.ts +0 -113
  90. package/src/hooks/use-human-in-the-loop.ts +0 -138
  91. package/src/hooks/use-langgraph-interrupt.ts +0 -103
  92. package/src/hooks/use-lazy-tool-renderer.tsx +0 -30
  93. package/src/hooks/use-make-copilot-document-readable.ts +0 -30
  94. package/src/hooks/use-render-tool-call.ts +0 -89
  95. package/src/hooks/use-tree.ts +0 -222
  96. package/src/index.tsx +0 -7
  97. package/src/lib/copilot-task.ts +0 -215
  98. package/src/lib/index.ts +0 -1
  99. package/src/lib/status-checker.ts +0 -67
  100. package/src/setupTests.ts +0 -37
  101. package/src/test-helpers/copilot-context.ts +0 -91
  102. package/src/types/chat-suggestion-configuration.ts +0 -23
  103. package/src/types/coagent-action.ts +0 -35
  104. package/src/types/coagent-state.ts +0 -13
  105. package/src/types/crew.ts +0 -89
  106. package/src/types/document-pointer.ts +0 -7
  107. package/src/types/frontend-action.ts +0 -213
  108. package/src/types/index.ts +0 -17
  109. package/src/types/interrupt-action.ts +0 -58
  110. package/src/types/system-message.ts +0 -4
  111. package/src/utils/dev-console.ts +0 -19
  112. package/src/utils/index.ts +0 -2
  113. package/src/utils/suggestions-constants.ts +0 -8
  114. package/src/utils/utils.test.ts +0 -7
  115. package/src/utils/utils.ts +0 -6
  116. package/src/v2/__tests__/A2UIMessageRenderer.test.tsx +0 -240
  117. package/src/v2/__tests__/globalSetup.ts +0 -14
  118. package/src/v2/__tests__/setup.ts +0 -93
  119. package/src/v2/__tests__/utils/test-helpers.tsx +0 -570
  120. package/src/v2/a2ui/A2UICatalogContext.tsx +0 -79
  121. package/src/v2/a2ui/A2UIMessageRenderer.tsx +0 -294
  122. package/src/v2/a2ui/A2UIToolCallRenderer.tsx +0 -290
  123. package/src/v2/components/CopilotKitInspector.tsx +0 -52
  124. package/src/v2/components/MCPAppsActivityRenderer.tsx +0 -815
  125. package/src/v2/components/OpenGenerativeUIRenderer.tsx +0 -598
  126. package/src/v2/components/WildcardToolCallRender.tsx +0 -86
  127. package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.tsx +0 -665
  128. package/src/v2/components/chat/CopilotChat.tsx +0 -664
  129. package/src/v2/components/chat/CopilotChatAssistantMessage.tsx +0 -393
  130. package/src/v2/components/chat/CopilotChatAttachmentQueue.tsx +0 -374
  131. package/src/v2/components/chat/CopilotChatAttachmentRenderer.tsx +0 -159
  132. package/src/v2/components/chat/CopilotChatAudioRecorder.tsx +0 -350
  133. package/src/v2/components/chat/CopilotChatInput.tsx +0 -1412
  134. package/src/v2/components/chat/CopilotChatMessageView.tsx +0 -716
  135. package/src/v2/components/chat/CopilotChatReasoningMessage.tsx +0 -265
  136. package/src/v2/components/chat/CopilotChatSuggestionPill.tsx +0 -59
  137. package/src/v2/components/chat/CopilotChatSuggestionView.tsx +0 -134
  138. package/src/v2/components/chat/CopilotChatToggleButton.tsx +0 -171
  139. package/src/v2/components/chat/CopilotChatToolCallsView.tsx +0 -40
  140. package/src/v2/components/chat/CopilotChatUserMessage.tsx +0 -445
  141. package/src/v2/components/chat/CopilotChatView.tsx +0 -890
  142. package/src/v2/components/chat/CopilotModalHeader.tsx +0 -129
  143. package/src/v2/components/chat/CopilotPopup.tsx +0 -81
  144. package/src/v2/components/chat/CopilotPopupView.tsx +0 -317
  145. package/src/v2/components/chat/CopilotSidebar.tsx +0 -80
  146. package/src/v2/components/chat/CopilotSidebarView.tsx +0 -269
  147. package/src/v2/components/chat/Lightbox.tsx +0 -103
  148. package/src/v2/components/chat/__tests__/CopilotChat.absentThreadConnect.test.tsx +0 -66
  149. package/src/v2/components/chat/__tests__/CopilotChat.attachments.test.tsx +0 -168
  150. package/src/v2/components/chat/__tests__/CopilotChat.e2e.test.tsx +0 -1239
  151. package/src/v2/components/chat/__tests__/CopilotChat.onError.test.tsx +0 -73
  152. package/src/v2/components/chat/__tests__/CopilotChat.slots.e2e.test.tsx +0 -432
  153. package/src/v2/components/chat/__tests__/CopilotChat.suggestionsAlways.test.tsx +0 -183
  154. package/src/v2/components/chat/__tests__/CopilotChat.welcomeGate.test.tsx +0 -184
  155. package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.tsx +0 -649
  156. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.slots.e2e.test.tsx +0 -624
  157. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.test.tsx +0 -702
  158. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.thumbs.test.tsx +0 -72
  159. package/src/v2/components/chat/__tests__/CopilotChatCopyButton.clipboard.test.tsx +0 -241
  160. package/src/v2/components/chat/__tests__/CopilotChatCssClasses.test.tsx +0 -107
  161. package/src/v2/components/chat/__tests__/CopilotChatInput.slots.e2e.test.tsx +0 -929
  162. package/src/v2/components/chat/__tests__/CopilotChatInput.test.tsx +0 -1567
  163. package/src/v2/components/chat/__tests__/CopilotChatMessageView.slots.e2e.test.tsx +0 -1004
  164. package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.tsx +0 -279
  165. package/src/v2/components/chat/__tests__/CopilotChatPerf.e2e.test.tsx +0 -336
  166. package/src/v2/components/chat/__tests__/CopilotChatPropsRerender.e2e.test.tsx +0 -249
  167. package/src/v2/components/chat/__tests__/CopilotChatSuggestionView.slots.e2e.test.tsx +0 -530
  168. package/src/v2/components/chat/__tests__/CopilotChatToolRendering.e2e.test.tsx +0 -785
  169. package/src/v2/components/chat/__tests__/CopilotChatToolRerenders.e2e.test.tsx +0 -2416
  170. package/src/v2/components/chat/__tests__/CopilotChatUserMessage.slots.e2e.test.tsx +0 -621
  171. package/src/v2/components/chat/__tests__/CopilotChatView.connectingGate.test.tsx +0 -56
  172. package/src/v2/components/chat/__tests__/CopilotChatView.inputOverlay.test.tsx +0 -264
  173. package/src/v2/components/chat/__tests__/CopilotChatView.onClick.e2e.test.tsx +0 -853
  174. package/src/v2/components/chat/__tests__/CopilotChatView.pinToSend.test.tsx +0 -94
  175. package/src/v2/components/chat/__tests__/CopilotChatView.slots.e2e.test.tsx +0 -1050
  176. package/src/v2/components/chat/__tests__/CopilotModalHeader.slots.e2e.test.tsx +0 -484
  177. package/src/v2/components/chat/__tests__/CopilotPopupView.slots.e2e.test.tsx +0 -612
  178. package/src/v2/components/chat/__tests__/CopilotSidebarView.position.test.tsx +0 -159
  179. package/src/v2/components/chat/__tests__/CopilotSidebarView.slots.e2e.test.tsx +0 -502
  180. package/src/v2/components/chat/__tests__/MCPAppsActivityRenderer.e2e.test.tsx +0 -1068
  181. package/src/v2/components/chat/__tests__/MCPAppsProxy.e2e.test.tsx +0 -589
  182. package/src/v2/components/chat/__tests__/MCPAppsUiMessage.e2e.test.tsx +0 -403
  183. package/src/v2/components/chat/__tests__/copilot-chat-throttle.test.tsx +0 -137
  184. package/src/v2/components/chat/__tests__/normalize-auto-scroll.test.ts +0 -37
  185. package/src/v2/components/chat/__tests__/setup.ts +0 -1
  186. package/src/v2/components/chat/index.ts +0 -90
  187. package/src/v2/components/chat/last-user-message-context.ts +0 -21
  188. package/src/v2/components/chat/normalize-auto-scroll.ts +0 -17
  189. package/src/v2/components/chat/scroll-element-context.ts +0 -13
  190. package/src/v2/components/index.ts +0 -8
  191. package/src/v2/components/intelligence-indicator/IntelligenceIndicator.tsx +0 -286
  192. package/src/v2/components/intelligence-indicator/__tests__/IntelligenceIndicator.e2e.test.tsx +0 -464
  193. package/src/v2/components/intelligence-indicator/index.ts +0 -2
  194. package/src/v2/components/license-warning-banner.tsx +0 -217
  195. package/src/v2/components/ui/button.tsx +0 -124
  196. package/src/v2/components/ui/dropdown-menu.tsx +0 -258
  197. package/src/v2/components/ui/tooltip.tsx +0 -60
  198. package/src/v2/context.ts +0 -62
  199. package/src/v2/headless.ts +0 -64
  200. package/src/v2/hooks/__tests__/standard-schema-types.test.tsx +0 -152
  201. package/src/v2/hooks/__tests__/standard-schema.test.tsx +0 -282
  202. package/src/v2/hooks/__tests__/use-agent-context-timing.e2e.test.tsx +0 -140
  203. package/src/v2/hooks/__tests__/use-agent-context.test.tsx +0 -401
  204. package/src/v2/hooks/__tests__/use-agent-error-state.test.tsx +0 -44
  205. package/src/v2/hooks/__tests__/use-agent-stability.test.tsx +0 -211
  206. package/src/v2/hooks/__tests__/use-agent-throttle.test.tsx +0 -1029
  207. package/src/v2/hooks/__tests__/use-agent.e2e.test.tsx +0 -159
  208. package/src/v2/hooks/__tests__/use-attachments.test.tsx +0 -169
  209. package/src/v2/hooks/__tests__/use-capabilities.test.tsx +0 -76
  210. package/src/v2/hooks/__tests__/use-component.test.tsx +0 -126
  211. package/src/v2/hooks/__tests__/use-configure-suggestions.e2e.test.tsx +0 -696
  212. package/src/v2/hooks/__tests__/use-default-render-tool.test.tsx +0 -153
  213. package/src/v2/hooks/__tests__/use-frontend-tool-available.test.tsx +0 -167
  214. package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.tsx +0 -2148
  215. package/src/v2/hooks/__tests__/use-human-in-the-loop.e2e.test.tsx +0 -1261
  216. package/src/v2/hooks/__tests__/use-interrupt.test.tsx +0 -397
  217. package/src/v2/hooks/__tests__/use-katex-styles.test.tsx +0 -56
  218. package/src/v2/hooks/__tests__/use-keyboard-height.test.tsx +0 -192
  219. package/src/v2/hooks/__tests__/use-pin-to-send.test.tsx +0 -219
  220. package/src/v2/hooks/__tests__/use-render-custom-messages.test.tsx +0 -55
  221. package/src/v2/hooks/__tests__/use-render-tool.test.tsx +0 -259
  222. package/src/v2/hooks/__tests__/use-suggestions.e2e.test.tsx +0 -524
  223. package/src/v2/hooks/__tests__/use-threads.test.tsx +0 -757
  224. package/src/v2/hooks/__tests__/zod-regression.test.tsx +0 -311
  225. package/src/v2/hooks/index.ts +0 -24
  226. package/src/v2/hooks/use-agent-context.tsx +0 -45
  227. package/src/v2/hooks/use-agent.tsx +0 -227
  228. package/src/v2/hooks/use-attachments.tsx +0 -269
  229. package/src/v2/hooks/use-capabilities.tsx +0 -25
  230. package/src/v2/hooks/use-component.tsx +0 -91
  231. package/src/v2/hooks/use-configure-suggestions.tsx +0 -236
  232. package/src/v2/hooks/use-default-render-tool.tsx +0 -271
  233. package/src/v2/hooks/use-frontend-tool.tsx +0 -46
  234. package/src/v2/hooks/use-human-in-the-loop.tsx +0 -81
  235. package/src/v2/hooks/use-interrupt.tsx +0 -305
  236. package/src/v2/hooks/use-keyboard-height.tsx +0 -67
  237. package/src/v2/hooks/use-pin-to-send.ts +0 -94
  238. package/src/v2/hooks/use-render-activity-message.tsx +0 -72
  239. package/src/v2/hooks/use-render-custom-messages.tsx +0 -93
  240. package/src/v2/hooks/use-render-tool-call.tsx +0 -208
  241. package/src/v2/hooks/use-render-tool.tsx +0 -184
  242. package/src/v2/hooks/use-suggestions.tsx +0 -91
  243. package/src/v2/hooks/use-threads.tsx +0 -325
  244. package/src/v2/hooks/useKatexStyles.ts +0 -27
  245. package/src/v2/index.css +0 -1
  246. package/src/v2/index.ts +0 -27
  247. package/src/v2/lib/__tests__/completePartialMarkdown.test.ts +0 -495
  248. package/src/v2/lib/__tests__/processPartialHtml.test.ts +0 -112
  249. package/src/v2/lib/__tests__/renderSlot.test.tsx +0 -588
  250. package/src/v2/lib/__tests__/slots.test.ts +0 -56
  251. package/src/v2/lib/processPartialHtml.ts +0 -45
  252. package/src/v2/lib/react-core.ts +0 -156
  253. package/src/v2/lib/slots.tsx +0 -184
  254. package/src/v2/lib/transcription-client.ts +0 -184
  255. package/src/v2/lib/utils.ts +0 -8
  256. package/src/v2/providers/CopilotChatConfigurationProvider.tsx +0 -196
  257. package/src/v2/providers/CopilotKitProvider.tsx +0 -800
  258. package/src/v2/providers/SandboxFunctionsContext.ts +0 -10
  259. package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.test.tsx +0 -652
  260. package/src/v2/providers/__tests__/CopilotKitProvider.license.test.tsx +0 -101
  261. package/src/v2/providers/__tests__/CopilotKitProvider.onError.test.tsx +0 -69
  262. package/src/v2/providers/__tests__/CopilotKitProvider.renderCustomMessages.e2e.test.tsx +0 -881
  263. package/src/v2/providers/__tests__/CopilotKitProvider.sandboxFunctions.test.tsx +0 -198
  264. package/src/v2/providers/__tests__/CopilotKitProvider.stability.test.tsx +0 -740
  265. package/src/v2/providers/__tests__/CopilotKitProvider.test.tsx +0 -713
  266. package/src/v2/providers/__tests__/CopilotKitProvider.wildcard.test.tsx +0 -294
  267. package/src/v2/providers/index.ts +0 -21
  268. package/src/v2/styles/globals.css +0 -349
  269. package/src/v2/types/__tests__/defineToolCallRenderer.test.tsx +0 -525
  270. package/src/v2/types/defineToolCallRenderer.ts +0 -68
  271. package/src/v2/types/frontend-tool.ts +0 -8
  272. package/src/v2/types/human-in-the-loop.ts +0 -33
  273. package/src/v2/types/index.ts +0 -8
  274. package/src/v2/types/interrupt.ts +0 -15
  275. package/src/v2/types/react-activity-message-renderer.ts +0 -27
  276. package/src/v2/types/react-custom-message-renderer.ts +0 -17
  277. package/src/v2/types/react-tool-call-renderer.ts +0 -35
  278. package/src/v2/types/sandbox-function.ts +0 -11
  279. package/tsconfig.json +0 -8
  280. package/tsdown.config.ts +0 -193
  281. package/typedoc.json +0 -4
  282. package/vitest.config.mjs +0 -31
@@ -1,124 +0,0 @@
1
- import * as React from "react";
2
- import { Slot } from "@radix-ui/react-slot";
3
- import { cva, type VariantProps } from "class-variance-authority";
4
-
5
- import { cn } from "../../lib/utils";
6
-
7
- const buttonVariants = cva(
8
- "cpk:inline-flex cpk:items-center cpk:justify-center cpk:gap-2 cpk:whitespace-nowrap cpk:rounded-md cpk:text-sm cpk:font-medium cpk:transition-all cpk:disabled:pointer-events-none cpk:disabled:opacity-50 cpk:[&_svg]:pointer-events-none cpk:[&_svg:not([class*='size-'])]:size-4 cpk:shrink-0 cpk:[&_svg]:shrink-0 cpk:outline-none cpk:focus-visible:border-ring cpk:focus-visible:ring-ring/50 cpk:focus-visible:ring-[3px] cpk:aria-invalid:ring-destructive/20 cpk:dark:aria-invalid:ring-destructive/40 cpk:aria-invalid:border-destructive",
9
- {
10
- variants: {
11
- variant: {
12
- default:
13
- "cpk:bg-primary cpk:text-primary-foreground cpk:shadow-xs cpk:hover:bg-primary/90",
14
- destructive:
15
- "cpk:bg-destructive cpk:text-white cpk:shadow-xs cpk:hover:bg-destructive/90 cpk:focus-visible:ring-destructive/20 cpk:dark:focus-visible:ring-destructive/40 cpk:dark:bg-destructive/60",
16
- outline:
17
- "cpk:border cpk:bg-background cpk:shadow-xs cpk:hover:bg-accent cpk:hover:text-accent-foreground cpk:dark:bg-input/30 cpk:dark:border-input cpk:dark:hover:bg-input/50",
18
- secondary:
19
- "cpk:bg-secondary cpk:text-secondary-foreground cpk:shadow-xs cpk:hover:bg-secondary/80",
20
- ghost:
21
- "cpk:hover:bg-accent cpk:hover:text-accent-foreground cpk:dark:hover:bg-accent/50 cpk:cursor-pointer",
22
- link: "cpk:text-primary cpk:underline-offset-4 cpk:hover:underline",
23
- assistantMessageToolbarButton: [
24
- "cpk:cursor-pointer",
25
- // Background and text
26
- "cpk:p-0 cpk:text-[rgb(93,93,93)] cpk:hover:bg-[#E8E8E8]",
27
- // Dark mode - lighter gray for better contrast
28
- "cpk:dark:text-[rgb(243,243,243)] cpk:dark:hover:bg-[#303030]",
29
- // Shape and sizing
30
- "cpk:h-8 cpk:w-8",
31
- // Interactions
32
- "cpk:transition-colors",
33
- // Hover states
34
- "cpk:hover:text-[rgb(93,93,93)]",
35
- "cpk:dark:hover:text-[rgb(243,243,243)]",
36
- ],
37
- chatInputToolbarPrimary: [
38
- "cpk:cursor-pointer",
39
- // Background and text
40
- "cpk:bg-black cpk:text-white",
41
- // Dark mode
42
- "cpk:dark:bg-white cpk:dark:text-black cpk:dark:focus-visible:outline-white",
43
- // Shape and sizing
44
- "cpk:rounded-full",
45
- // Interactions
46
- "cpk:transition-colors",
47
- // Focus states
48
- "cpk:focus:outline-none",
49
- // Hover states
50
- "cpk:hover:opacity-70 cpk:disabled:hover:opacity-100",
51
- // Disabled states
52
- "cpk:disabled:cursor-not-allowed cpk:disabled:bg-[#00000014] cpk:disabled:text-[rgb(13,13,13)]",
53
- "cpk:dark:disabled:bg-[#454545] cpk:dark:disabled:text-white ",
54
- ],
55
- chatInputToolbarSecondary: [
56
- "cpk:cursor-pointer",
57
- // Background and text
58
- "cpk:bg-transparent cpk:text-[#444444]",
59
- // Dark mode
60
- "cpk:dark:text-white cpk:dark:border-[#404040]",
61
- // Shape and sizing
62
- "cpk:rounded-full",
63
- // Interactions
64
- "cpk:transition-colors",
65
- // Focus states
66
- "cpk:focus:outline-none",
67
- // Hover states
68
- "cpk:hover:bg-[#f8f8f8] cpk:hover:text-[#333333]",
69
- "cpk:dark:hover:bg-[#404040] cpk:dark:hover:text-[#FFFFFF]",
70
- // Disabled states
71
- "cpk:disabled:cursor-not-allowed cpk:disabled:opacity-50",
72
- "cpk:disabled:hover:bg-transparent cpk:disabled:hover:text-[#444444]",
73
- "cpk:dark:disabled:hover:bg-transparent cpk:dark:disabled:hover:text-[#CCCCCC]",
74
- ],
75
- },
76
- size: {
77
- default: "cpk:h-9 cpk:px-4 cpk:py-2 cpk:has-[>svg]:px-3",
78
- sm: "cpk:h-8 cpk:rounded-md cpk:gap-1.5 cpk:px-3 cpk:has-[>svg]:px-2.5",
79
- lg: "cpk:h-10 cpk:rounded-md cpk:px-6 cpk:has-[>svg]:px-4",
80
- icon: "cpk:size-9",
81
- chatInputToolbarIcon: [
82
- // Shape and sizing
83
- "cpk:h-9 cpk:w-9 cpk:rounded-full",
84
- ],
85
- chatInputToolbarIconLabel: [
86
- // Shape and sizing
87
- "cpk:h-9 cpk:px-3 cpk:rounded-full",
88
- // Layout
89
- "cpk:gap-2",
90
- // Typography
91
- "cpk:font-normal",
92
- ],
93
- },
94
- },
95
- defaultVariants: {
96
- variant: "default",
97
- size: "default",
98
- },
99
- },
100
- );
101
-
102
- const Button = React.forwardRef<
103
- HTMLButtonElement,
104
- React.ComponentProps<"button"> &
105
- VariantProps<typeof buttonVariants> & {
106
- asChild?: boolean;
107
- }
108
- >(function Button(
109
- { className, variant, size, asChild = false, ...props },
110
- ref,
111
- ) {
112
- const Comp = asChild ? Slot : "button";
113
-
114
- return (
115
- <Comp
116
- ref={ref}
117
- data-slot="button"
118
- className={cn(buttonVariants({ variant, size, className }))}
119
- {...props}
120
- />
121
- );
122
- });
123
-
124
- export { Button, buttonVariants };
@@ -1,258 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
5
- import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
6
-
7
- import { cn } from "../../lib/utils";
8
-
9
- function DropdownMenu({
10
- ...props
11
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
12
- return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
13
- }
14
-
15
- function DropdownMenuPortal({
16
- ...props
17
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
18
- return (
19
- <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
20
- );
21
- }
22
-
23
- function DropdownMenuTrigger({
24
- ...props
25
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
26
- return (
27
- <DropdownMenuPrimitive.Trigger
28
- data-slot="dropdown-menu-trigger"
29
- {...props}
30
- />
31
- );
32
- }
33
-
34
- function DropdownMenuContent({
35
- className,
36
- sideOffset = 4,
37
- ...props
38
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
39
- return (
40
- <DropdownMenuPrimitive.Portal>
41
- <DropdownMenuPrimitive.Content
42
- data-copilotkit
43
- data-slot="dropdown-menu-content"
44
- sideOffset={sideOffset}
45
- className={cn(
46
- "cpk:bg-popover cpk:text-popover-foreground cpk:data-[state=open]:animate-in cpk:data-[state=closed]:animate-out cpk:data-[state=closed]:fade-out-0 cpk:data-[state=open]:fade-in-0 cpk:data-[state=closed]:zoom-out-95 cpk:data-[state=open]:zoom-in-95 cpk:data-[side=bottom]:slide-in-from-top-2 cpk:data-[side=left]:slide-in-from-right-2 cpk:data-[side=right]:slide-in-from-left-2 cpk:data-[side=top]:slide-in-from-bottom-2 cpk:z-50 cpk:max-h-(--radix-dropdown-menu-content-available-height) cpk:min-w-[8rem] cpk:origin-(--radix-dropdown-menu-content-transform-origin) cpk:overflow-x-hidden cpk:overflow-y-auto cpk:rounded-md cpk:border cpk:p-1 cpk:shadow-md",
47
- className,
48
- )}
49
- {...props}
50
- />
51
- </DropdownMenuPrimitive.Portal>
52
- );
53
- }
54
-
55
- function DropdownMenuGroup({
56
- ...props
57
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
58
- return (
59
- <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
60
- );
61
- }
62
-
63
- function DropdownMenuItem({
64
- className,
65
- inset,
66
- variant = "default",
67
- ...props
68
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
69
- inset?: boolean;
70
- variant?: "default" | "destructive";
71
- }) {
72
- return (
73
- <DropdownMenuPrimitive.Item
74
- data-slot="dropdown-menu-item"
75
- data-inset={inset}
76
- data-variant={variant}
77
- className={cn(
78
- "cpk:focus:bg-accent cpk:focus:text-accent-foreground cpk:data-[variant=destructive]:text-destructive cpk:data-[variant=destructive]:focus:bg-destructive/10 cpk:dark:data-[variant=destructive]:focus:bg-destructive/20 cpk:data-[variant=destructive]:focus:text-destructive cpk:data-[variant=destructive]:*:[svg]:!text-destructive cpk:[&_svg:not([class*='text-'])]:text-muted-foreground cpk:relative cpk:flex cpk:cursor-default cpk:items-center cpk:gap-2 cpk:rounded-sm cpk:px-2 cpk:py-1.5 cpk:text-sm cpk:outline-hidden cpk:select-none cpk:data-[disabled]:pointer-events-none cpk:data-[disabled]:opacity-50 cpk:data-[inset]:pl-8 cpk:[&_svg]:pointer-events-none cpk:[&_svg]:shrink-0 cpk:[&_svg:not([class*='size-'])]:size-4",
79
- className,
80
- )}
81
- {...props}
82
- />
83
- );
84
- }
85
-
86
- function DropdownMenuCheckboxItem({
87
- className,
88
- children,
89
- checked,
90
- ...props
91
- }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
92
- return (
93
- <DropdownMenuPrimitive.CheckboxItem
94
- data-slot="dropdown-menu-checkbox-item"
95
- className={cn(
96
- "cpk:focus:bg-accent cpk:focus:text-accent-foreground cpk:relative cpk:flex cpk:cursor-default cpk:items-center cpk:gap-2 cpk:rounded-sm cpk:py-1.5 cpk:pr-2 cpk:pl-8 cpk:text-sm cpk:outline-hidden cpk:select-none cpk:data-[disabled]:pointer-events-none cpk:data-[disabled]:opacity-50 cpk:[&_svg]:pointer-events-none cpk:[&_svg]:shrink-0 cpk:[&_svg:not([class*='size-'])]:size-4",
97
- className,
98
- )}
99
- checked={checked}
100
- {...props}
101
- >
102
- <span className="cpk:pointer-events-none cpk:absolute cpk:left-2 cpk:flex cpk:size-3.5 cpk:items-center cpk:justify-center">
103
- <DropdownMenuPrimitive.ItemIndicator>
104
- <CheckIcon className="cpk:size-4" />
105
- </DropdownMenuPrimitive.ItemIndicator>
106
- </span>
107
- {children}
108
- </DropdownMenuPrimitive.CheckboxItem>
109
- );
110
- }
111
-
112
- function DropdownMenuRadioGroup({
113
- ...props
114
- }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
115
- return (
116
- <DropdownMenuPrimitive.RadioGroup
117
- data-slot="dropdown-menu-radio-group"
118
- {...props}
119
- />
120
- );
121
- }
122
-
123
- function DropdownMenuRadioItem({
124
- className,
125
- children,
126
- ...props
127
- }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
128
- return (
129
- <DropdownMenuPrimitive.RadioItem
130
- data-slot="dropdown-menu-radio-item"
131
- className={cn(
132
- "cpk:focus:bg-accent cpk:focus:text-accent-foreground cpk:relative cpk:flex cpk:cursor-default cpk:items-center cpk:gap-2 cpk:rounded-sm cpk:py-1.5 cpk:pr-2 cpk:pl-8 cpk:text-sm cpk:outline-hidden cpk:select-none cpk:data-[disabled]:pointer-events-none cpk:data-[disabled]:opacity-50 cpk:[&_svg]:pointer-events-none cpk:[&_svg]:shrink-0 cpk:[&_svg:not([class*='size-'])]:size-4",
133
- className,
134
- )}
135
- {...props}
136
- >
137
- <span className="cpk:pointer-events-none cpk:absolute cpk:left-2 cpk:flex cpk:size-3.5 cpk:items-center cpk:justify-center">
138
- <DropdownMenuPrimitive.ItemIndicator>
139
- <CircleIcon className="cpk:size-2 cpk:fill-current" />
140
- </DropdownMenuPrimitive.ItemIndicator>
141
- </span>
142
- {children}
143
- </DropdownMenuPrimitive.RadioItem>
144
- );
145
- }
146
-
147
- function DropdownMenuLabel({
148
- className,
149
- inset,
150
- ...props
151
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
152
- inset?: boolean;
153
- }) {
154
- return (
155
- <DropdownMenuPrimitive.Label
156
- data-slot="dropdown-menu-label"
157
- data-inset={inset}
158
- className={cn(
159
- "cpk:px-2 cpk:py-1.5 cpk:text-sm cpk:font-medium cpk:data-[inset]:pl-8",
160
- className,
161
- )}
162
- {...props}
163
- />
164
- );
165
- }
166
-
167
- function DropdownMenuSeparator({
168
- className,
169
- ...props
170
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
171
- return (
172
- <DropdownMenuPrimitive.Separator
173
- data-slot="dropdown-menu-separator"
174
- className={cn("cpk:bg-border cpk:-mx-1 cpk:my-1 cpk:h-px", className)}
175
- {...props}
176
- />
177
- );
178
- }
179
-
180
- function DropdownMenuShortcut({
181
- className,
182
- ...props
183
- }: React.ComponentProps<"span">) {
184
- return (
185
- <span
186
- data-slot="dropdown-menu-shortcut"
187
- className={cn(
188
- "cpk:text-muted-foreground cpk:ml-auto cpk:text-xs cpk:tracking-widest",
189
- className,
190
- )}
191
- {...props}
192
- />
193
- );
194
- }
195
-
196
- function DropdownMenuSub({
197
- ...props
198
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
199
- return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />;
200
- }
201
-
202
- function DropdownMenuSubTrigger({
203
- className,
204
- inset,
205
- children,
206
- ...props
207
- }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
208
- inset?: boolean;
209
- }) {
210
- return (
211
- <DropdownMenuPrimitive.SubTrigger
212
- data-slot="dropdown-menu-sub-trigger"
213
- data-inset={inset}
214
- className={cn(
215
- "cpk:focus:bg-accent cpk:focus:text-accent-foreground cpk:data-[state=open]:bg-accent cpk:data-[state=open]:text-accent-foreground cpk:flex cpk:cursor-default cpk:items-center cpk:rounded-sm cpk:px-2 cpk:py-1.5 cpk:text-sm cpk:outline-hidden cpk:select-none cpk:data-[inset]:pl-8",
216
- className,
217
- )}
218
- {...props}
219
- >
220
- {children}
221
- <ChevronRightIcon className="cpk:ml-auto cpk:size-4" />
222
- </DropdownMenuPrimitive.SubTrigger>
223
- );
224
- }
225
-
226
- function DropdownMenuSubContent({
227
- className,
228
- ...props
229
- }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
230
- return (
231
- <DropdownMenuPrimitive.SubContent
232
- data-slot="dropdown-menu-sub-content"
233
- className={cn(
234
- "cpk:bg-popover cpk:text-popover-foreground cpk:data-[state=open]:animate-in cpk:data-[state=closed]:animate-out cpk:data-[state=closed]:fade-out-0 cpk:data-[state=open]:fade-in-0 cpk:data-[state=closed]:zoom-out-95 cpk:data-[state=open]:zoom-in-95 cpk:data-[side=bottom]:slide-in-from-top-2 cpk:data-[side=left]:slide-in-from-right-2 cpk:data-[side=right]:slide-in-from-left-2 cpk:data-[side=top]:slide-in-from-bottom-2 cpk:z-50 cpk:min-w-[8rem] cpk:origin-(--radix-dropdown-menu-content-transform-origin) cpk:overflow-hidden cpk:rounded-md cpk:border cpk:p-1 cpk:shadow-lg",
235
- className,
236
- )}
237
- {...props}
238
- />
239
- );
240
- }
241
-
242
- export {
243
- DropdownMenu,
244
- DropdownMenuPortal,
245
- DropdownMenuTrigger,
246
- DropdownMenuContent,
247
- DropdownMenuGroup,
248
- DropdownMenuLabel,
249
- DropdownMenuItem,
250
- DropdownMenuCheckboxItem,
251
- DropdownMenuRadioGroup,
252
- DropdownMenuRadioItem,
253
- DropdownMenuSeparator,
254
- DropdownMenuShortcut,
255
- DropdownMenuSub,
256
- DropdownMenuSubTrigger,
257
- DropdownMenuSubContent,
258
- };
@@ -1,60 +0,0 @@
1
- import * as React from "react";
2
- import * as TooltipPrimitive from "@radix-ui/react-tooltip";
3
-
4
- import { cn } from "../../lib/utils";
5
-
6
- function TooltipProvider({
7
- delayDuration = 0,
8
- ...props
9
- }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
10
- return (
11
- <TooltipPrimitive.Provider
12
- data-slot="tooltip-provider"
13
- delayDuration={delayDuration}
14
- {...props}
15
- />
16
- );
17
- }
18
-
19
- function Tooltip({
20
- ...props
21
- }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
22
- return (
23
- <TooltipProvider>
24
- <TooltipPrimitive.Root data-slot="tooltip" {...props} />
25
- </TooltipProvider>
26
- );
27
- }
28
-
29
- function TooltipTrigger({
30
- ...props
31
- }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
32
- return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
33
- }
34
-
35
- function TooltipContent({
36
- className,
37
- sideOffset = 0,
38
- children,
39
- ...props
40
- }: React.ComponentProps<typeof TooltipPrimitive.Content>) {
41
- return (
42
- <TooltipPrimitive.Portal>
43
- <TooltipPrimitive.Content
44
- data-copilotkit
45
- data-slot="tooltip-content"
46
- sideOffset={sideOffset}
47
- className={cn(
48
- "cpk:bg-primary cpk:text-primary-foreground cpk:animate-in cpk:fade-in-0 cpk:zoom-in-95 cpk:data-[state=closed]:animate-out cpk:data-[state=closed]:fade-out-0 cpk:data-[state=closed]:zoom-out-95 cpk:data-[side=bottom]:slide-in-from-top-2 cpk:data-[side=left]:slide-in-from-right-2 cpk:data-[side=right]:slide-in-from-left-2 cpk:data-[side=top]:slide-in-from-bottom-2 cpk:z-50 cpk:w-fit cpk:origin-(--radix-tooltip-content-transform-origin) cpk:rounded-md cpk:px-3 cpk:py-1.5 cpk:text-xs cpk:text-balance",
49
- className,
50
- )}
51
- {...props}
52
- >
53
- {children}
54
- <TooltipPrimitive.Arrow className="cpk:bg-primary cpk:fill-primary cpk:z-50 cpk:size-2.5 cpk:translate-y-[calc(-50%_-_2px)] cpk:rotate-45 cpk:rounded-[2px]" />
55
- </TooltipPrimitive.Content>
56
- </TooltipPrimitive.Portal>
57
- );
58
- }
59
-
60
- export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
package/src/v2/context.ts DELETED
@@ -1,62 +0,0 @@
1
- "use client";
2
-
3
- import { createContext, useContext, useEffect, useReducer } from "react";
4
- import { CopilotKitCoreReact } from "./lib/react-core";
5
- import type { CopilotKitCoreReactConfig } from "./lib/react-core";
6
- import type { LicenseContextValue } from "@copilotkit/shared";
7
-
8
- // Re-export so headless.ts (and consumers) reference the same type declaration.
9
- export { CopilotKitCoreReact };
10
- export type { CopilotKitCoreReactConfig };
11
-
12
- export interface CopilotKitContextValue {
13
- copilotkit: CopilotKitCoreReact;
14
- /**
15
- * Set of tool call IDs currently being executed.
16
- * This is tracked at the provider level to ensure tool execution events
17
- * are captured even before child components mount.
18
- */
19
- executingToolCallIds: ReadonlySet<string>;
20
- }
21
-
22
- export const EMPTY_SET: ReadonlySet<string> = new Set();
23
-
24
- export const CopilotKitContext = createContext<CopilotKitContextValue | null>(
25
- null,
26
- );
27
-
28
- export const useCopilotKit = (): CopilotKitContextValue => {
29
- const context = useContext(CopilotKitContext);
30
- const [, forceUpdate] = useReducer((x: number) => x + 1, 0);
31
-
32
- if (!context) {
33
- throw new Error("useCopilotKit must be used within CopilotKitProvider");
34
- }
35
- useEffect(() => {
36
- const subscription = context.copilotkit.subscribe({
37
- onRuntimeConnectionStatusChanged: () => {
38
- forceUpdate();
39
- },
40
- });
41
- return () => {
42
- subscription.unsubscribe();
43
- };
44
- // eslint-disable-next-line react-hooks/exhaustive-deps
45
- }, []);
46
-
47
- return context;
48
- };
49
-
50
- // License context — shared between web and RN providers.
51
- // Default is permissive (all features allowed) — providers override via createLicenseContextValue.
52
- // Inlined here to avoid a runtime import from @copilotkit/shared, which pulls in
53
- // Node-only deps (jose) that break React Native's Metro bundler.
54
- export const LicenseContext = createContext<LicenseContextValue>({
55
- status: null,
56
- license: null,
57
- checkFeature: () => true,
58
- getLimit: () => null,
59
- } as LicenseContextValue);
60
-
61
- export const useLicenseContext = (): LicenseContextValue =>
62
- useContext(LicenseContext);
@@ -1,64 +0,0 @@
1
- /**
2
- * Headless (platform-agnostic) exports from @copilotkit/react-core/v2.
3
- *
4
- * No CSS, no web UI components, no DOM dependencies.
5
- * Used by @copilotkit/react-native.
6
- */
7
-
8
- // Re-export from context (which is external in this build) so the .d.ts
9
- // references the same type declaration. This avoids a nominal type mismatch
10
- // caused by private class members being declared in two separate .d.ts files.
11
- export { CopilotKitCoreReact } from "./context";
12
- export type { CopilotKitCoreReactConfig } from "./context";
13
-
14
- // Chat configuration provider (no UI, just context)
15
- export {
16
- CopilotChatConfigurationProvider,
17
- useCopilotChatConfiguration,
18
- CopilotChatDefaultLabels,
19
- type CopilotChatLabels,
20
- type CopilotChatConfigurationValue,
21
- type CopilotChatConfigurationProviderProps,
22
- } from "./providers/CopilotChatConfigurationProvider";
23
-
24
- // Platform-agnostic hooks
25
- export { useAgent, type UseAgentUpdate } from "./hooks/use-agent";
26
- export { useFrontendTool } from "./hooks/use-frontend-tool";
27
- export { useComponent } from "./hooks/use-component";
28
- export { useHumanInTheLoop } from "./hooks/use-human-in-the-loop";
29
- export {
30
- useInterrupt,
31
- type UseInterruptConfig,
32
- type InterruptEvent,
33
- type InterruptHandlerProps,
34
- type InterruptRenderProps,
35
- } from "./hooks/use-interrupt";
36
- export { useSuggestions } from "./hooks/use-suggestions";
37
- export { useConfigureSuggestions } from "./hooks/use-configure-suggestions";
38
- export {
39
- useAgentContext,
40
- type AgentContextInput,
41
- type JsonSerializable,
42
- } from "./hooks/use-agent-context";
43
- export {
44
- useThreads,
45
- type Thread,
46
- type UseThreadsInput,
47
- type UseThreadsResult,
48
- } from "./hooks/use-threads";
49
-
50
- export {
51
- useRenderTool,
52
- type RenderToolProps,
53
- type RenderToolInProgressProps,
54
- type RenderToolExecutingProps,
55
- type RenderToolCompleteProps,
56
- } from "./hooks/use-render-tool";
57
- export { defineToolCallRenderer } from "./types/defineToolCallRenderer";
58
-
59
- // Platform-agnostic types
60
- export type { ReactFrontendTool } from "./types/frontend-tool";
61
- export type { ReactHumanInTheLoop } from "./types/human-in-the-loop";
62
-
63
- // Platform-agnostic capability introspection
64
- export { useCapabilities } from "./hooks/use-capabilities";