@copilotkit/vue 2.0.0-rc.0 → 2.0.0-rc.10

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 (317) hide show
  1. package/PARITY.md +13 -12
  2. package/README.md +1 -2
  3. package/dist/components/copilot-provider/CopilotKit.vue.d.ts +3 -1
  4. package/dist/components/copilot-provider/CopilotKit.vue.d.ts.map +1 -1
  5. package/dist/hooks/use-copilot-action.d.ts.map +1 -1
  6. package/dist/hooks/use-frontend-tool.d.ts +1 -1
  7. package/dist/hooks/use-frontend-tool.d.ts.map +1 -1
  8. package/dist/hooks/zod-parameters.d.ts +14 -0
  9. package/dist/hooks/zod-parameters.d.ts.map +1 -0
  10. package/dist/index.cjs +1 -76
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.mjs +384 -14275
  13. package/dist/index.mjs.map +1 -1
  14. package/dist/use-render-activity-message-CTR_ziWV.js +18097 -0
  15. package/dist/use-render-activity-message-CTR_ziWV.js.map +1 -0
  16. package/dist/use-render-activity-message-Dky9_GRG.cjs +92 -0
  17. package/dist/use-render-activity-message-Dky9_GRG.cjs.map +1 -0
  18. package/dist/v2/components/A2UIMessageRenderer.d.ts +7 -0
  19. package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -1
  20. package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -1
  21. package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -1
  22. package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +13 -45
  23. package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -1
  24. package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +11 -2
  25. package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -1
  26. package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +1 -1
  27. package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -1
  28. package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts +144 -0
  29. package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts.map +1 -0
  30. package/dist/v2/components/a2ui.d.ts +3 -7
  31. package/dist/v2/components/a2ui.d.ts.map +1 -1
  32. package/dist/v2/components/chat/CopilotChat.vue.d.ts +1 -0
  33. package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
  34. package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts +3 -1
  35. package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -1
  36. package/dist/v2/components/chat/CopilotChatAssistantToolbarButton.vue.d.ts +16 -0
  37. package/dist/v2/components/chat/CopilotChatAssistantToolbarButton.vue.d.ts.map +1 -0
  38. package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -1
  39. package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts.map +1 -1
  40. package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts.map +1 -1
  41. package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts +22 -0
  42. package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts.map +1 -0
  43. package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +21 -232
  44. package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -1
  45. package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts +12 -0
  46. package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts.map +1 -0
  47. package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts +22 -0
  48. package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts.map +1 -0
  49. package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +20 -0
  50. package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -1
  51. package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -1
  52. package/dist/v2/components/chat/CopilotChatSuggestionPill.vue.d.ts.map +1 -1
  53. package/dist/v2/components/chat/CopilotChatSuggestionView.vue.d.ts.map +1 -1
  54. package/dist/v2/components/chat/CopilotChatToggleButton.vue.d.ts.map +1 -1
  55. package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts +32 -0
  56. package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts.map +1 -0
  57. package/dist/v2/components/chat/CopilotChatToolCallItem.vue.d.ts.map +1 -1
  58. package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +11 -1
  59. package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -1
  60. package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts.map +1 -1
  61. package/dist/v2/components/chat/CopilotChatView.vue.d.ts +1 -0
  62. package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -1
  63. package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts +5 -0
  64. package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts.map +1 -0
  65. package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -1
  66. package/dist/v2/components/chat/CopilotModalHeaderCloseButton.d.ts.map +1 -1
  67. package/dist/v2/components/chat/CopilotModalHeaderTitle.d.ts.map +1 -1
  68. package/dist/v2/components/chat/CopilotPopup.vue.d.ts +1 -0
  69. package/dist/v2/components/chat/CopilotPopup.vue.d.ts.map +1 -1
  70. package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +1 -0
  71. package/dist/v2/components/chat/CopilotPopupView.vue.d.ts.map +1 -1
  72. package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +1 -0
  73. package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -1
  74. package/dist/v2/components/chat/CopilotPopupWelcomeScreen.vue.d.ts.map +1 -1
  75. package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +2 -0
  76. package/dist/v2/components/chat/CopilotSidebar.vue.d.ts.map +1 -1
  77. package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +2 -0
  78. package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts.map +1 -1
  79. package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +2 -0
  80. package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -1
  81. package/dist/v2/components/chat/CopilotSidebarWelcomeScreen.vue.d.ts.map +1 -1
  82. package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts.map +1 -1
  83. package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts +0 -1
  84. package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts.map +1 -1
  85. package/dist/v2/components/chat/index.d.ts +17 -1
  86. package/dist/v2/components/chat/index.d.ts.map +1 -1
  87. package/dist/v2/components/chat/inspector-shortcuts.d.ts +12 -0
  88. package/dist/v2/components/chat/inspector-shortcuts.d.ts.map +1 -0
  89. package/dist/v2/components/chat/message-feedback.d.ts +89 -0
  90. package/dist/v2/components/chat/message-feedback.d.ts.map +1 -0
  91. package/dist/v2/components/chat/tool-call-capture.d.ts +39 -0
  92. package/dist/v2/components/chat/tool-call-capture.d.ts.map +1 -0
  93. package/dist/v2/components/chat/tool-call-display-context.d.ts +22 -0
  94. package/dist/v2/components/chat/tool-call-display-context.d.ts.map +1 -0
  95. package/dist/v2/components/chat/tool-call-group-parts.d.ts +131 -0
  96. package/dist/v2/components/chat/tool-call-group-parts.d.ts.map +1 -0
  97. package/dist/v2/components/chat/turn-work.d.ts +33 -0
  98. package/dist/v2/components/chat/turn-work.d.ts.map +1 -0
  99. package/dist/v2/components/chat/types.d.ts +104 -5
  100. package/dist/v2/components/chat/types.d.ts.map +1 -1
  101. package/dist/v2/components/chat/use-chat-labels.d.ts +8 -0
  102. package/dist/v2/components/chat/use-chat-labels.d.ts.map +1 -0
  103. package/dist/v2/components/chat/use-lightbox.d.ts +18 -0
  104. package/dist/v2/components/chat/use-lightbox.d.ts.map +1 -0
  105. package/dist/v2/components/icons/index.d.ts +968 -1
  106. package/dist/v2/components/icons/index.d.ts.map +1 -1
  107. package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts +55 -0
  108. package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts.map +1 -0
  109. package/dist/v2/components/ui/CopilotPopover.vue.d.ts +40 -0
  110. package/dist/v2/components/ui/CopilotPopover.vue.d.ts.map +1 -0
  111. package/dist/v2/components/ui/CopilotTooltip.vue.d.ts +37 -0
  112. package/dist/v2/components/ui/CopilotTooltip.vue.d.ts.map +1 -0
  113. package/dist/v2/components/ui/dropdown-menu.d.ts +14 -0
  114. package/dist/v2/components/ui/dropdown-menu.d.ts.map +1 -0
  115. package/dist/v2/components/ui/floating.d.ts +84 -0
  116. package/dist/v2/components/ui/floating.d.ts.map +1 -0
  117. package/dist/v2/components/ui/presence.d.ts +9 -0
  118. package/dist/v2/components/ui/presence.d.ts.map +1 -0
  119. package/dist/v2/components/ui/use-id.d.ts +9 -0
  120. package/dist/v2/components/ui/use-id.d.ts.map +1 -0
  121. package/dist/v2/hooks/use-default-render-tool.d.ts +6 -0
  122. package/dist/v2/hooks/use-default-render-tool.d.ts.map +1 -1
  123. package/dist/v2/hooks/use-frontend-tool.d.ts +5 -0
  124. package/dist/v2/hooks/use-frontend-tool.d.ts.map +1 -1
  125. package/dist/v2/hooks/use-render-activity-message.d.ts +13 -9
  126. package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -1
  127. package/dist/v2/hooks/use-render-custom-messages.d.ts +5 -7
  128. package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -1
  129. package/dist/v2/hooks/use-render-tool.d.ts +4 -0
  130. package/dist/v2/hooks/use-render-tool.d.ts.map +1 -1
  131. package/dist/v2/index.cjs +1 -1
  132. package/dist/v2/index.d.cts +3 -0
  133. package/dist/v2/index.d.mts +3 -0
  134. package/dist/v2/index.d.ts +3 -0
  135. package/dist/v2/index.d.ts.map +1 -1
  136. package/dist/v2/index.mjs +197 -197
  137. package/dist/v2/index.mjs.map +1 -1
  138. package/dist/v2/lib/message-feedback.d.ts +33 -0
  139. package/dist/v2/lib/message-feedback.d.ts.map +1 -0
  140. package/dist/v2/lib/processPartialHtml.d.ts +1 -2
  141. package/dist/v2/lib/processPartialHtml.d.ts.map +1 -1
  142. package/dist/v2/lib/vue-core.d.ts +0 -1
  143. package/dist/v2/lib/vue-core.d.ts.map +1 -1
  144. package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -1
  145. package/dist/v2/providers/CopilotKitProvider.types.d.ts +56 -6
  146. package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
  147. package/dist/v2/providers/CopilotKitProvider.vue.d.ts +6 -2
  148. package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
  149. package/dist/v2/providers/index.d.ts +1 -1
  150. package/dist/v2/providers/index.d.ts.map +1 -1
  151. package/dist/v2/providers/keys.d.ts +8 -0
  152. package/dist/v2/providers/keys.d.ts.map +1 -1
  153. package/dist/v2/providers/types.d.ts +3 -37
  154. package/dist/v2/providers/types.d.ts.map +1 -1
  155. package/dist/v2/styles/CopilotKitStyles.d.ts +18 -0
  156. package/dist/v2/styles/CopilotKitStyles.d.ts.map +1 -0
  157. package/dist/v2/types/defineToolCallRenderer.d.ts +2 -0
  158. package/dist/v2/types/defineToolCallRenderer.d.ts.map +1 -1
  159. package/dist/v2/types/human-in-the-loop.d.ts +8 -29
  160. package/dist/v2/types/human-in-the-loop.d.ts.map +1 -1
  161. package/dist/v2/types/interrupt.d.ts +1 -22
  162. package/dist/v2/types/interrupt.d.ts.map +1 -1
  163. package/dist/v2/types/vue-activity-message-renderer.d.ts +16 -15
  164. package/dist/v2/types/vue-activity-message-renderer.d.ts.map +1 -1
  165. package/dist/v2/types/vue-custom-message-renderer.d.ts +7 -16
  166. package/dist/v2/types/vue-custom-message-renderer.d.ts.map +1 -1
  167. package/dist/v2/types/vue-tool-call-renderer.d.ts +16 -28
  168. package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -1
  169. package/package.json +14 -27
  170. package/src/__tests__/build-entries.test.ts +27 -0
  171. package/src/components/copilot-provider/CopilotKit.vue +4 -1
  172. package/src/hooks/__tests__/zod-parameters.test.ts +520 -0
  173. package/src/hooks/use-copilot-action.ts +2 -1
  174. package/src/hooks/use-frontend-tool.ts +3 -6
  175. package/src/hooks/zod-parameters.ts +162 -0
  176. package/src/v2/__tests__/exports.test.ts +4 -2
  177. package/src/v2/components/A2UIMessageRenderer.ts +56 -68
  178. package/src/v2/components/A2UISurfaceActivityRenderer.vue +11 -23
  179. package/src/v2/components/LicenseWarningBanner.vue +31 -15
  180. package/src/v2/components/OpenGenerativeUIRenderer.ts +51 -373
  181. package/src/v2/components/__tests__/A2UIBasicCatalogColors.test.ts +8 -9
  182. package/src/v2/components/__tests__/A2UICatalogContext.test.ts +1 -1
  183. package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +63 -36
  184. package/src/v2/components/__tests__/LicenseWarningBanner.test.ts +20 -0
  185. package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +55 -6
  186. package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +15 -258
  187. package/src/v2/components/a2ui/A2UICatalogContext.ts +10 -102
  188. package/src/v2/components/a2ui/A2UIRecoveryStates.ts +444 -0
  189. package/src/v2/components/a2ui/__tests__/A2UIRecoveryStates.test.ts +175 -0
  190. package/src/v2/components/a2ui.ts +1 -1
  191. package/src/v2/components/chat/CopilotChat.vue +26 -40
  192. package/src/v2/components/chat/CopilotChatAssistantMessage.vue +267 -67
  193. package/src/v2/components/chat/CopilotChatAssistantToolbarButton.vue +46 -0
  194. package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +150 -173
  195. package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +77 -20
  196. package/src/v2/components/chat/CopilotChatAudioRecorder.vue +2 -2
  197. package/src/v2/components/chat/CopilotChatFeedbackCommentPopover.vue +240 -0
  198. package/src/v2/components/chat/CopilotChatInput.vue +250 -191
  199. package/src/v2/components/chat/CopilotChatInspectorButton.vue +331 -0
  200. package/src/v2/components/chat/CopilotChatLightbox.vue +105 -0
  201. package/src/v2/components/chat/CopilotChatMessageView.vue +262 -87
  202. package/src/v2/components/chat/CopilotChatReasoningMessage.vue +52 -35
  203. package/src/v2/components/chat/CopilotChatSuggestionPill.vue +5 -14
  204. package/src/v2/components/chat/CopilotChatSuggestionView.vue +1 -4
  205. package/src/v2/components/chat/CopilotChatToggleButton.vue +3 -9
  206. package/src/v2/components/chat/CopilotChatToggleButtonCloseIcon.ts +1 -1
  207. package/src/v2/components/chat/CopilotChatToggleButtonOpenIcon.ts +1 -1
  208. package/src/v2/components/chat/CopilotChatToolCallGroup.vue +353 -0
  209. package/src/v2/components/chat/CopilotChatToolCallItem.vue +24 -14
  210. package/src/v2/components/chat/CopilotChatToolCallsView.vue +194 -21
  211. package/src/v2/components/chat/CopilotChatUserMessage.vue +105 -42
  212. package/src/v2/components/chat/CopilotChatView.vue +37 -42
  213. package/src/v2/components/chat/CopilotChatWorkSummary.vue +111 -0
  214. package/src/v2/components/chat/CopilotModalHeader.vue +10 -8
  215. package/src/v2/components/chat/CopilotModalHeaderCloseButton.ts +7 -6
  216. package/src/v2/components/chat/CopilotModalHeaderTitle.ts +1 -4
  217. package/src/v2/components/chat/CopilotPopup.vue +3 -0
  218. package/src/v2/components/chat/CopilotPopupView.vue +1 -0
  219. package/src/v2/components/chat/CopilotPopupViewInternal.vue +9 -19
  220. package/src/v2/components/chat/CopilotPopupWelcomeScreen.vue +5 -8
  221. package/src/v2/components/chat/CopilotSidebar.vue +5 -0
  222. package/src/v2/components/chat/CopilotSidebarView.vue +2 -0
  223. package/src/v2/components/chat/CopilotSidebarViewInternal.vue +24 -17
  224. package/src/v2/components/chat/CopilotSidebarWelcomeScreen.vue +7 -10
  225. package/src/v2/components/chat/StreamingMarkdownDefault.vue +3 -5
  226. package/src/v2/components/chat/__tests__/CopilotChat.labels.test.ts +19 -4
  227. package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.ts +26 -9
  228. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.inspector.test.ts +269 -0
  229. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.learningFeedback.test.ts +760 -0
  230. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.slots.e2e.test.ts +3 -5
  231. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.test.ts +2 -2
  232. package/src/v2/components/chat/__tests__/CopilotChatInput.addMenu.test.ts +328 -0
  233. package/src/v2/components/chat/__tests__/CopilotChatInput.slots.e2e.test.ts +6 -3
  234. package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +55 -14
  235. package/src/v2/components/chat/__tests__/CopilotChatLightbox.test.ts +160 -0
  236. package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.ts +247 -403
  237. package/src/v2/components/chat/__tests__/CopilotChatMessageView.toolCallDisplay.test.ts +637 -0
  238. package/src/v2/components/chat/__tests__/CopilotChatSuggestionPill.test.ts +1 -1
  239. package/src/v2/components/chat/__tests__/CopilotChatSuggestionView.slots.e2e.test.ts +3 -1
  240. package/src/v2/components/chat/__tests__/CopilotChatToolCallsView.learning.test.ts +75 -0
  241. package/src/v2/components/chat/__tests__/CopilotChatUserMessage.attachments.test.ts +143 -0
  242. package/src/v2/components/chat/__tests__/CopilotChatView.inputOverlay.test.ts +5 -4
  243. package/src/v2/components/chat/__tests__/CopilotChatView.rootWidth.test.ts +7 -33
  244. package/src/v2/components/chat/__tests__/CopilotModalHeader.slots.e2e.test.ts +1 -1
  245. package/src/v2/components/chat/__tests__/CopilotPopupView.slots.e2e.test.ts +3 -3
  246. package/src/v2/components/chat/__tests__/CopilotSidebarView.position.test.ts +126 -0
  247. package/src/v2/components/chat/__tests__/messageFeedbackDefaults.test.ts +33 -0
  248. package/src/v2/components/chat/__tests__/modalChatDisplayProps.test.ts +44 -0
  249. package/src/v2/components/chat/copilotChatToolCallItemRender.ts +3 -19
  250. package/src/v2/components/chat/index.ts +2 -1
  251. package/src/v2/components/chat/inspector-shortcuts.ts +34 -0
  252. package/src/v2/components/chat/message-feedback.ts +291 -0
  253. package/src/v2/components/chat/tool-call-capture.ts +55 -0
  254. package/src/v2/components/chat/tool-call-display-context.ts +28 -0
  255. package/src/v2/components/chat/tool-call-group-parts.ts +251 -0
  256. package/src/v2/components/chat/turn-work.ts +52 -0
  257. package/src/v2/components/chat/types.ts +114 -4
  258. package/src/v2/components/chat/use-chat-labels.ts +16 -0
  259. package/src/v2/components/chat/use-lightbox.ts +64 -0
  260. package/src/v2/components/icons/__tests__/icons.test.ts +72 -68
  261. package/src/v2/components/icons/index.ts +109 -23
  262. package/src/v2/components/ui/CopilotDropdownMenuContent.vue +465 -0
  263. package/src/v2/components/ui/CopilotPopover.vue +138 -0
  264. package/src/v2/components/ui/CopilotTooltip.vue +237 -0
  265. package/src/v2/components/ui/__tests__/CopilotTooltip.test.ts +168 -0
  266. package/src/v2/components/ui/dropdown-menu.ts +15 -0
  267. package/src/v2/components/ui/floating.ts +321 -0
  268. package/src/v2/components/ui/presence.ts +54 -0
  269. package/src/v2/components/ui/use-id.ts +16 -0
  270. package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +62 -1
  271. package/src/v2/hooks/__tests__/use-render-activity-message.test.ts +105 -0
  272. package/src/v2/hooks/__tests__/use-render-tool.test.ts +3 -6
  273. package/src/v2/hooks/__tests__/zod-regression.test.ts +5 -4
  274. package/src/v2/hooks/use-default-render-tool.ts +123 -62
  275. package/src/v2/hooks/use-frontend-tool.ts +10 -10
  276. package/src/v2/hooks/use-render-activity-message.ts +27 -48
  277. package/src/v2/hooks/use-render-custom-messages.ts +14 -35
  278. package/src/v2/hooks/use-render-tool.ts +8 -0
  279. package/src/v2/index.ts +3 -0
  280. package/src/v2/lib/__tests__/message-feedback.test.ts +152 -0
  281. package/src/v2/lib/message-feedback.ts +120 -0
  282. package/src/v2/lib/processPartialHtml.ts +6 -21
  283. package/src/v2/lib/vue-core.ts +3 -5
  284. package/src/v2/providers/CopilotChatConfigurationProvider.vue +29 -2
  285. package/src/v2/providers/CopilotKitProvider.types.ts +57 -5
  286. package/src/v2/providers/CopilotKitProvider.vue +177 -114
  287. package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.openThread.test.ts +69 -0
  288. package/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.ts +1 -1
  289. package/src/v2/providers/__tests__/CopilotKitProvider.headersAtSendTime.test.ts +3 -3
  290. package/src/v2/providers/__tests__/CopilotKitProvider.learning.test.ts +536 -0
  291. package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +17 -33
  292. package/src/v2/providers/index.ts +4 -1
  293. package/src/v2/providers/keys.ts +12 -0
  294. package/src/v2/providers/types.ts +3 -38
  295. package/src/v2/styles/CopilotKitStyles.ts +95 -0
  296. package/src/v2/styles/__tests__/CopilotKitStyles.client.test.ts +149 -0
  297. package/src/v2/styles/__tests__/CopilotKitStyles.ssr.test.ts +71 -0
  298. package/src/v2/types/__tests__/defineToolCallRenderer.test.ts +28 -33
  299. package/src/v2/types/defineToolCallRenderer.ts +9 -4
  300. package/src/v2/types/human-in-the-loop.ts +8 -32
  301. package/src/v2/types/interrupt.ts +7 -31
  302. package/src/v2/types/vue-activity-message-renderer.ts +24 -15
  303. package/src/v2/types/vue-custom-message-renderer.ts +12 -16
  304. package/src/v2/types/vue-tool-call-renderer.ts +23 -31
  305. package/vite.config.ts +5 -5
  306. package/dist/styles.css +0 -2
  307. package/dist/v2/components/chat/BasicMarkdown.vue.d.ts +0 -9
  308. package/dist/v2/components/chat/BasicMarkdown.vue.d.ts.map +0 -1
  309. package/dist/v2/lib/transcription-client.d.ts +0 -19
  310. package/dist/v2/lib/transcription-client.d.ts.map +0 -1
  311. package/scripts/scope-preflight.mjs +0 -100
  312. package/src/styles/globals.css +0 -233
  313. package/src/v2/components/chat/BasicMarkdown.vue +0 -158
  314. package/src/v2/components/chat/__tests__/BasicMarkdown.test.ts +0 -69
  315. package/src/v2/lib/__tests__/processPartialHtml.test.ts +0 -84
  316. package/src/v2/lib/__tests__/transcription-client.test.ts +0 -67
  317. package/src/v2/lib/transcription-client.ts +0 -151
@@ -33,12 +33,7 @@ const ariaLabel = computed(() =>
33
33
  : labels.value.chatToggleOpenLabel,
34
34
  );
35
35
  const buttonClass = computed(() => [
36
- "cpk:fixed cpk:bottom-6 cpk:right-6 cpk:z-[1100] cpk:flex cpk:h-14 cpk:w-14 cpk:items-center cpk:justify-center",
37
- "cpk:rounded-full cpk:border cpk:border-primary cpk:bg-primary cpk:text-primary-foreground",
38
- "cpk:shadow-sm cpk:transition-all cpk:duration-200 cpk:ease-out",
39
- "cpk:hover:scale-[1.04] cpk:hover:shadow-md cpk:cursor-pointer cpk:active:scale-[0.96]",
40
- "cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-primary/50 cpk:focus-visible:ring-offset-2 cpk:focus-visible:ring-offset-background",
41
- "cpk:disabled:pointer-events-none cpk:disabled:opacity-60",
36
+ "copilotKitButton cpk-chat-toggle-button",
42
37
  attrs.class,
43
38
  ]);
44
39
  const buttonAttrs = computed(() => {
@@ -46,13 +41,12 @@ const buttonAttrs = computed(() => {
46
41
  return rest;
47
42
  });
48
43
 
49
- const iconClass = "cpk:h-6 cpk:w-6";
44
+ const iconClass = "cpk-chat-toggle-button-icon";
50
45
  const iconTransitionStyle = Object.freeze({
51
46
  transition:
52
47
  "opacity 120ms ease-out, transform 260ms cubic-bezier(0.22, 1, 0.36, 1)",
53
48
  });
54
- const iconWrapperBase =
55
- "cpk:pointer-events-none cpk:absolute cpk:inset-0 cpk:flex cpk:items-center cpk:justify-center cpk:will-change-transform";
49
+ const iconWrapperBase = "cpk-chat-toggle-button-icon-wrapper";
56
50
 
57
51
  function setModalOpen(open: boolean) {
58
52
  if (config.value?.setModalOpen) {
@@ -9,7 +9,7 @@ export default defineComponent({
9
9
  const { class: className, ...rest } = attrs as Record<string, unknown>;
10
10
  return h(IconX, {
11
11
  ...rest,
12
- class: ["cpk:h-6 cpk:w-6", className],
12
+ class: ["cpk-chat-toggle-button-icon", className],
13
13
  strokeWidth: 1.75,
14
14
  });
15
15
  };
@@ -9,7 +9,7 @@ export default defineComponent({
9
9
  const { class: className, ...rest } = attrs as Record<string, unknown>;
10
10
  return h(IconMessageCircle, {
11
11
  ...rest,
12
- class: ["cpk:h-6 cpk:w-6", className],
12
+ class: ["cpk-chat-toggle-button-icon", className],
13
13
  strokeWidth: 1.75,
14
14
  fill: "currentColor",
15
15
  });
@@ -0,0 +1,353 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * Tool calls made in a row, collapsed into one summary. While a call runs the
4
+ * summary names it ("Running read_file src/app.ts"); once they're all done it
5
+ * reads "Used 3 tools" and opens to the calls.
6
+ *
7
+ * Each call is drawn by the `call` slot, which the tool calls view fills with
8
+ * the registered renderers. CopilotKit's built-in card (`useDefaultRenderTool`)
9
+ * draws a compact row inside the card and line appearances and an open stack;
10
+ * a custom wildcard renderer draws whatever it draws.
11
+ */
12
+ import { computed, provide, ref } from "vue";
13
+ import {
14
+ ɵformatLabel,
15
+ ɵformatToolNames,
16
+ ɵgetToolCallPreview,
17
+ ɵgetToolCallRowStatus,
18
+ ɵformatCountLabel,
19
+ } from "@copilotkit/core";
20
+ import type { ToolCallEntry, ɵToolCallRowStatus } from "@copilotkit/core";
21
+ import { useCopilotId } from "../ui/use-id";
22
+ import { ToolCallGroupContextKey } from "./tool-call-display-context";
23
+ import type { ToolCallGroupContextValue } from "./tool-call-display-context";
24
+ import {
25
+ CopilotChatCollapsible,
26
+ ToolCallChevron,
27
+ ToolCallFailedCount,
28
+ ToolCallStatusIcon,
29
+ toolCallStatusLabel,
30
+ } from "./tool-call-group-parts";
31
+ import { useChatLabels } from "./use-chat-labels";
32
+ import type { CopilotChatToolCallGroupAppearance } from "./types";
33
+
34
+ const props = withDefaults(
35
+ defineProps<{
36
+ /** The calls in the group, in order. */
37
+ calls: ToolCallEntry[];
38
+ /**
39
+ * - `"card"` (default): one card with a summary header and a row per call.
40
+ * - `"line"`: a quiet line of text that opens to a list of rows.
41
+ * - `"stack"`: the latest call on a stack of the earlier ones.
42
+ */
43
+ appearance?: CopilotChatToolCallGroupAppearance;
44
+ /** The agent is running and nothing follows the group, so more calls may join it. */
45
+ isActive?: boolean;
46
+ }>(),
47
+ { appearance: "card", isActive: false },
48
+ );
49
+
50
+ defineSlots<{
51
+ /** Draws one call. */
52
+ call(props: { call: ToolCallEntry }): unknown;
53
+ }>();
54
+
55
+ const labels = useChatLabels();
56
+ const open = ref(false);
57
+ const bodyId = useCopilotId("cpk-tool-call-group");
58
+ const toggle = () => {
59
+ open.value = !open.value;
60
+ };
61
+
62
+ const latest = computed(() => props.calls[props.calls.length - 1]);
63
+ // Only an active group has a call in progress. Between calls nothing is
64
+ // running, so the latest call stays the subject (or the label flickers).
65
+ const current = computed(() =>
66
+ props.isActive
67
+ ? (props.calls.find((call) => !call.toolMessage) ?? latest.value)
68
+ : undefined,
69
+ );
70
+ const preview = computed(() =>
71
+ current.value ? ɵgetToolCallPreview(current.value) : undefined,
72
+ );
73
+ const done = computed(
74
+ () => props.calls.filter((call) => call.toolMessage).length,
75
+ );
76
+ const statuses = computed(() =>
77
+ props.calls.map((call) => ɵgetToolCallRowStatus(call, props.isActive)),
78
+ );
79
+ const failedIds = computed(
80
+ () =>
81
+ new Set(
82
+ props.calls
83
+ .filter((_, index) => statuses.value[index] === "failed")
84
+ .map((call) => call.toolCall.id),
85
+ ),
86
+ );
87
+ const status = computed<ɵToolCallRowStatus>(() =>
88
+ current.value
89
+ ? "running"
90
+ : failedIds.value.size > 0
91
+ ? "failed"
92
+ : statuses.value.includes("stopped")
93
+ ? "stopped"
94
+ : "done",
95
+ );
96
+ const single = computed(
97
+ () =>
98
+ props.appearance === "line" && props.calls.length === 1 && !current.value,
99
+ );
100
+
101
+ provide(
102
+ ToolCallGroupContextKey,
103
+ computed<ToolCallGroupContextValue>(() => ({
104
+ appearance: props.appearance,
105
+ failedIds: failedIds.value,
106
+ active: props.isActive,
107
+ })),
108
+ );
109
+
110
+ // Stack: a lone call is the top card of a stack with nothing behind it yet.
111
+ const behind = computed(() =>
112
+ open.value ? 0 : Math.min(props.calls.length - 1, 2),
113
+ );
114
+ const latestStatus = computed(() =>
115
+ latest.value ? ɵgetToolCallRowStatus(latest.value, props.isActive) : "done",
116
+ );
117
+ const latestPreview = computed(() =>
118
+ latest.value ? ɵgetToolCallPreview(latest.value) : undefined,
119
+ );
120
+ const runningLabel = computed(() =>
121
+ current.value
122
+ ? ɵformatLabel(labels.value.toolCallRunningLabel, {
123
+ name: current.value.toolCall.function.name,
124
+ })
125
+ : "",
126
+ );
127
+ const usedToolsLabel = computed(() =>
128
+ ɵformatCountLabel(props.calls.length, {
129
+ one: labels.value.toolCallUsedToolsOne,
130
+ other: labels.value.toolCallUsedToolsOther,
131
+ }),
132
+ );
133
+ const toolNames = computed(() => ɵformatToolNames(props.calls));
134
+ const latestStatusLabel = computed(() =>
135
+ toolCallStatusLabel(labels.value, latestStatus.value),
136
+ );
137
+ const layer = "cpk-tool-call-group-stack-layer";
138
+ </script>
139
+
140
+ <template>
141
+ <div
142
+ v-if="latest && single"
143
+ data-copilotkit
144
+ data-testid="copilot-tool-call-group"
145
+ :data-appearance="appearance"
146
+ :data-state="status"
147
+ class="cpk-tool-call-group cpk-tool-call-group-line cpk-tool-call-group-single"
148
+ >
149
+ <slot name="call" :call="latest" />
150
+ </div>
151
+
152
+ <div
153
+ v-else-if="latest && appearance === 'line'"
154
+ data-copilotkit
155
+ data-testid="copilot-tool-call-group"
156
+ :data-appearance="appearance"
157
+ :data-state="status"
158
+ class="cpk-tool-call-group cpk-tool-call-group-line"
159
+ >
160
+ <button
161
+ type="button"
162
+ :aria-expanded="open ? 'true' : 'false'"
163
+ :aria-controls="bodyId"
164
+ class="cpk-tool-call-group-line-toggle"
165
+ @click="toggle"
166
+ >
167
+ <template v-if="current">
168
+ <span class="cpk-tool-call-group-running cpk-shimmer">{{
169
+ runningLabel
170
+ }}</span>
171
+ <span v-if="preview" class="cpk-tool-call-group-preview">{{
172
+ preview
173
+ }}</span>
174
+ </template>
175
+ <template v-else>
176
+ <span class="cpk-tool-call-group-line-summary">{{
177
+ usedToolsLabel
178
+ }}</span>
179
+ <span class="cpk-tool-call-group-line-names">{{ toolNames }}</span>
180
+ <ToolCallFailedCount :calls="calls" />
181
+ </template>
182
+ <ToolCallChevron :open="open" />
183
+ </button>
184
+ <CopilotChatCollapsible :id="bodyId" :open="open">
185
+ <div class="cpk-tool-call-group-line-body">
186
+ <template v-for="call in calls" :key="call.toolCall.id">
187
+ <slot name="call" :call="call" />
188
+ </template>
189
+ </div>
190
+ </CopilotChatCollapsible>
191
+ </div>
192
+
193
+ <div
194
+ v-else-if="latest && appearance === 'stack'"
195
+ data-copilotkit
196
+ data-testid="copilot-tool-call-group"
197
+ :data-appearance="appearance"
198
+ :data-state="status"
199
+ class="cpk-tool-call-group cpk-tool-call-group-stack"
200
+ :style="{ paddingBottom: `${behind * 6}px` }"
201
+ >
202
+ <div class="cpk-tool-call-group-stack-pile">
203
+ <div
204
+ v-for="index in behind"
205
+ :key="index"
206
+ aria-hidden="true"
207
+ :class="[layer, 'cpk-tool-call-group-stack-behind']"
208
+ :style="{
209
+ transform: `translateY(${index * 6}px) scaleX(${1 - index * 0.045})`,
210
+ zIndex: -index,
211
+ opacity: 1 - index * 0.28,
212
+ }"
213
+ />
214
+ <!-- One toggle in both states, so it keeps keyboard focus when pressed. -->
215
+ <button
216
+ type="button"
217
+ :aria-expanded="open ? 'true' : 'false'"
218
+ :aria-controls="open ? bodyId : undefined"
219
+ :class="[
220
+ 'cpk-tool-call-group-stack-toggle',
221
+ open
222
+ ? 'cpk-tool-call-group-stack-toggle-open'
223
+ : [layer, 'cpk-tool-call-group-stack-toggle-closed'],
224
+ ]"
225
+ @click="toggle"
226
+ >
227
+ <template v-if="open">
228
+ {{
229
+ ɵformatCountLabel(calls.length, {
230
+ one: labels.toolCallToolCallCountOne,
231
+ other: labels.toolCallToolCallCountOther,
232
+ })
233
+ }}
234
+ <ToolCallFailedCount :calls="calls" />
235
+ <span class="cpk-tool-call-group-stack-collapse">
236
+ {{ labels.toolCallCollapseLabel }}
237
+ <ToolCallChevron
238
+ :open="true"
239
+ class="cpk-tool-call-group-stack-collapse-icon"
240
+ />
241
+ </span>
242
+ </template>
243
+ <template v-else>
244
+ <span
245
+ :key="latest.toolCall.id"
246
+ class="cpk-tool-call-group-stack-latest"
247
+ >
248
+ <ToolCallStatusIcon :status="latestStatus" />
249
+ <span
250
+ :class="[
251
+ 'cpk-tool-call-group-stack-name',
252
+ latestStatus === 'running' && 'cpk-shimmer',
253
+ ]"
254
+ >{{ latest.toolCall.function.name }}</span
255
+ >
256
+ <span
257
+ v-if="latestPreview"
258
+ class="cpk-tool-call-group-stack-preview"
259
+ >{{ latestPreview }}</span
260
+ >
261
+ <!-- The status icon is decorative, so say the status. -->
262
+ <span class="cpk-tool-call-group-stack-status">{{
263
+ latestStatusLabel
264
+ }}</span>
265
+ </span>
266
+ <span class="cpk-tool-call-group-stack-meta">
267
+ <ToolCallFailedCount :calls="calls" />
268
+ <span class="cpk-tool-call-group-stack-count">{{
269
+ ɵformatCountLabel(calls.length, {
270
+ one: labels.toolCallCallCountOne,
271
+ other: labels.toolCallCallCountOther,
272
+ })
273
+ }}</span>
274
+ <ToolCallChevron
275
+ :open="false"
276
+ class="cpk-tool-call-group-stack-expand-icon"
277
+ />
278
+ </span>
279
+ </template>
280
+ </button>
281
+ <!-- Always mounted, so screen readers hear the closed stack's latest
282
+ call change ("read_file: Running", then "read_file: Done"); the
283
+ button only names it. -->
284
+ <span aria-live="polite" class="cpk-tool-call-group-stack-live">{{
285
+ open ? "" : `${latest.toolCall.function.name}: ${latestStatusLabel}`
286
+ }}</span>
287
+ </div>
288
+ <!-- Each call gets the collapsed stack's card, easing out of the stack. -->
289
+ <div v-if="open" :id="bodyId" class="cpk-tool-call-group-stack-items">
290
+ <div
291
+ v-for="(call, index) in calls"
292
+ :key="call.toolCall.id"
293
+ :class="[layer, 'cpk-tool-call-group-stack-item']"
294
+ :style="{ animationDelay: `${index * 30}ms` }"
295
+ >
296
+ <slot name="call" :call="call" />
297
+ </div>
298
+ </div>
299
+ </div>
300
+
301
+ <!-- card: one call gets the same card as several, so the card a run
302
+ starts with doesn't change style when the next call joins it. -->
303
+ <div
304
+ v-else-if="latest"
305
+ data-copilotkit
306
+ data-testid="copilot-tool-call-group"
307
+ :data-appearance="appearance"
308
+ :data-state="status"
309
+ class="cpk-tool-call-group cpk-tool-call-group-card"
310
+ >
311
+ <button
312
+ type="button"
313
+ :aria-expanded="open ? 'true' : 'false'"
314
+ :aria-controls="bodyId"
315
+ class="cpk-tool-call-group-card-toggle"
316
+ @click="toggle"
317
+ >
318
+ <ToolCallStatusIcon :status="status" />
319
+ <template v-if="current">
320
+ <span class="cpk-tool-call-group-running cpk-shimmer">{{
321
+ runningLabel
322
+ }}</span>
323
+ <span v-if="preview" class="cpk-tool-call-group-preview">{{
324
+ preview
325
+ }}</span>
326
+ </template>
327
+ <template v-else>
328
+ <span class="cpk-tool-call-group-card-summary">{{
329
+ usedToolsLabel
330
+ }}</span>
331
+ <span class="cpk-tool-call-group-card-names">{{ toolNames }}</span>
332
+ </template>
333
+ <span class="cpk-tool-call-group-card-meta">
334
+ <ToolCallFailedCount v-if="status === 'failed'" :calls="calls" />
335
+ <span v-else class="cpk-tool-call-group-card-status">{{
336
+ status !== "running"
337
+ ? toolCallStatusLabel(labels, status)
338
+ : done > 0
339
+ ? ɵformatLabel(labels.toolCallDoneCountLabel, { count: done })
340
+ : ""
341
+ }}</span>
342
+ <ToolCallChevron :open="open" />
343
+ </span>
344
+ </button>
345
+ <CopilotChatCollapsible :id="bodyId" :open="open">
346
+ <div>
347
+ <template v-for="call in calls" :key="call.toolCall.id">
348
+ <slot name="call" :call="call" />
349
+ </template>
350
+ </div>
351
+ </CopilotChatCollapsible>
352
+ </div>
353
+ </template>
@@ -1,16 +1,20 @@
1
1
  <script setup lang="ts">
2
2
  import type { Message, ToolCall } from "@ag-ui/core";
3
3
  import { DEFAULT_AGENT_ID } from "@copilotkit/shared";
4
+ import { ɵresolveToolCallRenderer } from "@copilotkit/core";
4
5
  import { useCopilotKit } from "../../providers/useCopilotKit";
5
6
  import { useCopilotChatConfiguration } from "../../providers/useCopilotChatConfiguration";
6
7
  import type { CopilotChatToolCallRenderSlotProps } from "./types";
7
8
  import {
8
- getCoreRenderConfig,
9
9
  getCoreRenderProps,
10
10
  getToolCallMemoDeps,
11
11
  getToolCallRenderProps,
12
12
  getToolCallSlotName,
13
13
  } from "./copilotChatToolCallItemRender";
14
+ import {
15
+ ToolCallCaptureScope,
16
+ useLearningConfigured,
17
+ } from "./tool-call-capture";
14
18
 
15
19
  const props = withDefaults(
16
20
  defineProps<{
@@ -31,6 +35,7 @@ defineSlots<{
31
35
 
32
36
  const { copilotkit, executingToolCallIds } = useCopilotKit();
33
37
  const config = useCopilotChatConfiguration();
38
+ const learningConfigured = useLearningConfigured(copilotkit);
34
39
 
35
40
  function getRenderProps(): CopilotChatToolCallRenderSlotProps {
36
41
  return getToolCallRenderProps(
@@ -50,9 +55,9 @@ function getCoreProps() {
50
55
 
51
56
  function getRenderConfig() {
52
57
  const agentId = config.value?.agentId ?? DEFAULT_AGENT_ID;
53
- return getCoreRenderConfig(
54
- props.toolCall,
58
+ return ɵresolveToolCallRenderer(
55
59
  copilotkit.value.renderToolCalls,
60
+ props.toolCall.function.name,
56
61
  agentId,
57
62
  );
58
63
  }
@@ -70,17 +75,22 @@ function getMemoDeps() {
70
75
  </script>
71
76
 
72
77
  <template>
73
- <slot
74
- :name="getToolCallSlotName(toolCall.function.name)"
75
- v-bind="getRenderProps()"
78
+ <ToolCallCaptureScope
79
+ :tool-call-id="toolCall.id"
80
+ :enabled="learningConfigured"
76
81
  >
77
- <slot name="tool-call" v-bind="getRenderProps()">
78
- <component
79
- :is="getRenderConfig()?.render"
80
- v-if="getRenderConfig()"
81
- v-memo="getMemoDeps()"
82
- v-bind="getCoreProps()"
83
- />
82
+ <slot
83
+ :name="getToolCallSlotName(toolCall.function.name)"
84
+ v-bind="getRenderProps()"
85
+ >
86
+ <slot name="tool-call" v-bind="getRenderProps()">
87
+ <component
88
+ :is="getRenderConfig()?.render"
89
+ v-if="getRenderConfig()"
90
+ v-memo="getMemoDeps()"
91
+ v-bind="getCoreProps()"
92
+ />
93
+ </slot>
84
94
  </slot>
85
- </slot>
95
+ </ToolCallCaptureScope>
86
96
  </template>