@copilotkit/vue 2.0.0-rc.3 → 2.0.0-rc.31

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 (343) hide show
  1. package/CONTRIBUTOR_GUIDE.md +1 -1
  2. package/PARITY.md +3 -3
  3. package/dist/hooks/use-copilot-action.d.ts.map +1 -1
  4. package/dist/hooks/use-frontend-tool.d.ts +1 -1
  5. package/dist/hooks/use-frontend-tool.d.ts.map +1 -1
  6. package/dist/hooks/zod-parameters.d.ts +14 -0
  7. package/dist/hooks/zod-parameters.d.ts.map +1 -0
  8. package/dist/index.cjs +1 -73
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.mjs +365 -16920
  11. package/dist/index.mjs.map +1 -1
  12. package/dist/use-render-activity-message-BMTHA_P2.js +15901 -0
  13. package/dist/use-render-activity-message-BMTHA_P2.js.map +1 -0
  14. package/dist/use-render-activity-message-CH3beu7z.cjs +113 -0
  15. package/dist/use-render-activity-message-CH3beu7z.cjs.map +1 -0
  16. package/dist/v2/components/A2UIMessageRenderer.d.ts +14 -0
  17. package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -1
  18. package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts +10 -3
  19. package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -1
  20. package/dist/v2/components/CopilotKitInspector.vue.d.ts +5 -1
  21. package/dist/v2/components/CopilotKitInspector.vue.d.ts.map +1 -1
  22. package/dist/v2/components/InlineFeatureWarning.vue.d.ts.map +1 -1
  23. package/dist/v2/components/LicenseWarningBanner.vue.d.ts +2 -2
  24. package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -1
  25. package/dist/v2/components/MCPAppsActivityRenderer.d.ts.map +1 -1
  26. package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +13 -59
  27. package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -1
  28. package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +3 -11
  29. package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -1
  30. package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +10 -15
  31. package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -1
  32. package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts +14 -130
  33. package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts.map +1 -1
  34. package/dist/v2/components/a2ui/catalog.d.ts.map +1 -1
  35. package/dist/v2/components/a2ui/utils.d.ts +3 -15
  36. package/dist/v2/components/a2ui/utils.d.ts.map +1 -1
  37. package/dist/v2/components/a2ui.d.ts +9 -8
  38. package/dist/v2/components/a2ui.d.ts.map +1 -1
  39. package/dist/v2/components/chat/CopilotChat.vue.d.ts +2 -2
  40. package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
  41. package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -1
  42. package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -1
  43. package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts.map +1 -1
  44. package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts +4 -8
  45. package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts.map +1 -1
  46. package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts +1 -1
  47. package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts.map +1 -1
  48. package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +7 -286
  49. package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -1
  50. package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts.map +1 -1
  51. package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts.map +1 -1
  52. package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +1 -1
  53. package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -1
  54. package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -1
  55. package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts +1 -1
  56. package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts.map +1 -1
  57. package/dist/v2/components/chat/CopilotChatToolCallItem.vue.d.ts.map +1 -1
  58. package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +1 -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 +3 -3
  62. package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -1
  63. package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts.map +1 -1
  64. package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -1
  65. package/dist/v2/components/chat/CopilotPopup.vue.d.ts +8 -3
  66. package/dist/v2/components/chat/CopilotPopup.vue.d.ts.map +1 -1
  67. package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +5 -3
  68. package/dist/v2/components/chat/CopilotPopupView.vue.d.ts.map +1 -1
  69. package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +5 -3
  70. package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -1
  71. package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +8 -3
  72. package/dist/v2/components/chat/CopilotSidebar.vue.d.ts.map +1 -1
  73. package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +6 -4
  74. package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts.map +1 -1
  75. package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +6 -4
  76. package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -1
  77. package/dist/v2/components/chat/CopilotThreadsDrawer.vue.d.ts.map +1 -1
  78. package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts +1 -0
  79. package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts.map +1 -1
  80. package/dist/v2/components/chat/audioRecorder.d.ts +3 -4
  81. package/dist/v2/components/chat/audioRecorder.d.ts.map +1 -1
  82. package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts +4 -4
  83. package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts.map +1 -1
  84. package/dist/v2/components/chat/forwarded-slots.d.ts +12 -0
  85. package/dist/v2/components/chat/forwarded-slots.d.ts.map +1 -0
  86. package/dist/v2/components/chat/index.d.ts +34 -31
  87. package/dist/v2/components/chat/index.d.ts.map +1 -1
  88. package/dist/v2/components/chat/inspector-shortcuts.d.ts +2 -1
  89. package/dist/v2/components/chat/inspector-shortcuts.d.ts.map +1 -1
  90. package/dist/v2/components/chat/message-feedback.d.ts +38 -49
  91. package/dist/v2/components/chat/message-feedback.d.ts.map +1 -1
  92. package/dist/v2/components/chat/tool-call-display-context.d.ts +4 -19
  93. package/dist/v2/components/chat/tool-call-display-context.d.ts.map +1 -1
  94. package/dist/v2/components/chat/tool-call-group-parts.d.ts +7 -20
  95. package/dist/v2/components/chat/tool-call-group-parts.d.ts.map +1 -1
  96. package/dist/v2/components/chat/turn-work.d.ts +0 -2
  97. package/dist/v2/components/chat/turn-work.d.ts.map +1 -1
  98. package/dist/v2/components/chat/types.d.ts +9 -4
  99. package/dist/v2/components/chat/types.d.ts.map +1 -1
  100. package/dist/v2/components/chat/use-chat-labels.d.ts +8 -0
  101. package/dist/v2/components/chat/use-chat-labels.d.ts.map +1 -0
  102. package/dist/v2/components/chat/use-copy-feedback.d.ts +11 -0
  103. package/dist/v2/components/chat/use-copy-feedback.d.ts.map +1 -0
  104. package/dist/v2/components/chat/use-lightbox.d.ts.map +1 -1
  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 +1 -1
  108. package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts.map +1 -1
  109. package/dist/v2/hooks/use-agent-context.d.ts +2 -3
  110. package/dist/v2/hooks/use-agent-context.d.ts.map +1 -1
  111. package/dist/v2/hooks/use-agent.d.ts +4 -1
  112. package/dist/v2/hooks/use-agent.d.ts.map +1 -1
  113. package/dist/v2/hooks/use-attachments.d.ts +7 -0
  114. package/dist/v2/hooks/use-attachments.d.ts.map +1 -1
  115. package/dist/v2/hooks/use-capabilities.d.ts.map +1 -1
  116. package/dist/v2/hooks/use-component.d.ts +1 -0
  117. package/dist/v2/hooks/use-component.d.ts.map +1 -1
  118. package/dist/v2/hooks/use-configure-suggestions.d.ts +4 -9
  119. package/dist/v2/hooks/use-configure-suggestions.d.ts.map +1 -1
  120. package/dist/v2/hooks/use-default-render-tool.d.ts +2 -7
  121. package/dist/v2/hooks/use-default-render-tool.d.ts.map +1 -1
  122. package/dist/v2/hooks/use-frontend-tool.d.ts +5 -0
  123. package/dist/v2/hooks/use-frontend-tool.d.ts.map +1 -1
  124. package/dist/v2/hooks/use-human-in-the-loop.d.ts +2 -1
  125. package/dist/v2/hooks/use-human-in-the-loop.d.ts.map +1 -1
  126. package/dist/v2/hooks/use-interrupt.d.ts +0 -1
  127. package/dist/v2/hooks/use-interrupt.d.ts.map +1 -1
  128. package/dist/v2/hooks/use-keyboard-height.d.ts +1 -1
  129. package/dist/v2/hooks/use-keyboard-height.d.ts.map +1 -1
  130. package/dist/v2/hooks/use-pin-to-send.d.ts +4 -12
  131. package/dist/v2/hooks/use-pin-to-send.d.ts.map +1 -1
  132. package/dist/v2/hooks/use-render-activity-message.d.ts +13 -9
  133. package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -1
  134. package/dist/v2/hooks/use-render-custom-messages.d.ts +5 -7
  135. package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -1
  136. package/dist/v2/hooks/use-render-tool.d.ts +1 -1
  137. package/dist/v2/hooks/use-render-tool.d.ts.map +1 -1
  138. package/dist/v2/hooks/use-suggestions.d.ts.map +1 -1
  139. package/dist/v2/hooks/use-threads.d.ts +6 -23
  140. package/dist/v2/hooks/use-threads.d.ts.map +1 -1
  141. package/dist/v2/index.cjs +1 -1
  142. package/dist/v2/index.mjs +197 -200
  143. package/dist/v2/index.mjs.map +1 -1
  144. package/dist/v2/lib/processPartialHtml.d.ts +1 -2
  145. package/dist/v2/lib/processPartialHtml.d.ts.map +1 -1
  146. package/dist/v2/lib/shallow-stable.d.ts.map +1 -1
  147. package/dist/v2/lib/vue-core.d.ts +33 -19
  148. package/dist/v2/lib/vue-core.d.ts.map +1 -1
  149. package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -1
  150. package/dist/v2/providers/CopilotKitProvider.types.d.ts +9 -129
  151. package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
  152. package/dist/v2/providers/CopilotKitProvider.vue.d.ts +9 -10
  153. package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
  154. package/dist/v2/providers/chat-configuration-store-key.d.ts +8 -0
  155. package/dist/v2/providers/chat-configuration-store-key.d.ts.map +1 -0
  156. package/dist/v2/providers/markdown-renderer.d.ts +4 -2
  157. package/dist/v2/providers/markdown-renderer.d.ts.map +1 -1
  158. package/dist/v2/providers/types.d.ts +3 -46
  159. package/dist/v2/providers/types.d.ts.map +1 -1
  160. package/dist/v2/providers/use-inspector-thread-override.d.ts +5 -0
  161. package/dist/v2/providers/use-inspector-thread-override.d.ts.map +1 -1
  162. package/dist/v2/types/defineToolCallRenderer.d.ts +1 -1
  163. package/dist/v2/types/defineToolCallRenderer.d.ts.map +1 -1
  164. package/dist/v2/types/human-in-the-loop.d.ts +8 -29
  165. package/dist/v2/types/human-in-the-loop.d.ts.map +1 -1
  166. package/dist/v2/types/interrupt.d.ts +1 -22
  167. package/dist/v2/types/interrupt.d.ts.map +1 -1
  168. package/dist/v2/types/vue-activity-message-renderer.d.ts +16 -15
  169. package/dist/v2/types/vue-activity-message-renderer.d.ts.map +1 -1
  170. package/dist/v2/types/vue-custom-message-renderer.d.ts +7 -16
  171. package/dist/v2/types/vue-custom-message-renderer.d.ts.map +1 -1
  172. package/dist/v2/types/vue-tool-call-renderer.d.ts +16 -35
  173. package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -1
  174. package/package.json +12 -13
  175. package/src/__tests__/build-entries.test.ts +29 -0
  176. package/src/hooks/__tests__/zod-parameters.test.ts +520 -0
  177. package/src/hooks/use-copilot-action.ts +2 -1
  178. package/src/hooks/use-frontend-tool.ts +3 -6
  179. package/src/hooks/zod-parameters.ts +162 -0
  180. package/src/v2/__tests__/exports.test.ts +10 -0
  181. package/src/v2/__tests__/mocks/web-inspector.ts +6 -0
  182. package/src/v2/__tests__/utils/test-helpers.ts +34 -4
  183. package/src/v2/components/A2UIMessageRenderer.ts +98 -68
  184. package/src/v2/components/A2UISurfaceActivityRenderer.vue +68 -103
  185. package/src/v2/components/CopilotKitInspector.vue +104 -51
  186. package/src/v2/components/InlineFeatureWarning.vue +20 -21
  187. package/src/v2/components/LicenseWarningBanner.vue +27 -135
  188. package/src/v2/components/MCPAppsActivityRenderer.ts +75 -201
  189. package/src/v2/components/OpenGenerativeUIRenderer.ts +122 -446
  190. package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +171 -8
  191. package/src/v2/components/__tests__/CopilotKitInspector.test.ts +42 -0
  192. package/src/v2/components/__tests__/LicenseWarningBanner.test.ts +60 -0
  193. package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +64 -8
  194. package/src/v2/components/__tests__/OpenGenerativeUIToolRenderer.test.ts +38 -0
  195. package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +6 -26
  196. package/src/v2/components/a2ui/A2UICatalogContext.ts +27 -185
  197. package/src/v2/components/a2ui/A2UIRecoveryStates.ts +127 -327
  198. package/src/v2/components/a2ui/catalog.ts +3 -3
  199. package/src/v2/components/a2ui/utils.ts +13 -65
  200. package/src/v2/components/a2ui.ts +15 -22
  201. package/src/v2/components/chat/CopilotChat.vue +121 -498
  202. package/src/v2/components/chat/CopilotChatAssistantMessage.vue +47 -184
  203. package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +36 -55
  204. package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +14 -6
  205. package/src/v2/components/chat/CopilotChatAudioRecorder.vue +19 -246
  206. package/src/v2/components/chat/CopilotChatFeedbackCommentPopover.vue +12 -77
  207. package/src/v2/components/chat/CopilotChatInput.vue +139 -654
  208. package/src/v2/components/chat/CopilotChatInspectorButton.vue +45 -108
  209. package/src/v2/components/chat/CopilotChatLightbox.vue +10 -31
  210. package/src/v2/components/chat/CopilotChatMessageView.vue +96 -274
  211. package/src/v2/components/chat/CopilotChatReasoningMessage.vue +27 -62
  212. package/src/v2/components/chat/CopilotChatToolCallGroup.vue +63 -71
  213. package/src/v2/components/chat/CopilotChatToolCallItem.vue +8 -6
  214. package/src/v2/components/chat/CopilotChatToolCallsView.vue +31 -32
  215. package/src/v2/components/chat/CopilotChatUserMessage.vue +24 -112
  216. package/src/v2/components/chat/CopilotChatView.vue +123 -161
  217. package/src/v2/components/chat/CopilotChatWorkSummary.vue +26 -36
  218. package/src/v2/components/chat/CopilotModalHeader.vue +11 -23
  219. package/src/v2/components/chat/CopilotPopup.vue +23 -25
  220. package/src/v2/components/chat/CopilotPopupView.vue +10 -39
  221. package/src/v2/components/chat/CopilotPopupViewInternal.vue +49 -185
  222. package/src/v2/components/chat/CopilotSidebar.vue +23 -25
  223. package/src/v2/components/chat/CopilotSidebarView.vue +10 -39
  224. package/src/v2/components/chat/CopilotSidebarViewInternal.vue +56 -100
  225. package/src/v2/components/chat/CopilotThreadsDrawer.vue +43 -105
  226. package/src/v2/components/chat/StreamingMarkdownDefault.vue +15 -28
  227. package/src/v2/components/chat/__tests__/CopilotChat.labels.test.ts +19 -4
  228. package/src/v2/components/chat/__tests__/CopilotChat.test.ts +12 -10
  229. package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.ts +26 -9
  230. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.learningFeedback.test.ts +5 -5
  231. package/src/v2/components/chat/__tests__/CopilotChatAttachmentQueue.test.ts +28 -0
  232. package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +132 -1
  233. package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.ts +247 -403
  234. package/src/v2/components/chat/__tests__/CopilotChatMessageView.toolCallDisplay.test.ts +1 -99
  235. package/src/v2/components/chat/__tests__/CopilotChatView.pinToSend.test.ts +43 -1
  236. package/src/v2/components/chat/__tests__/CopilotPopup.test.ts +90 -1
  237. package/src/v2/components/chat/__tests__/CopilotPopupView.test.ts +19 -0
  238. package/src/v2/components/chat/__tests__/CopilotSidebar.test.ts +90 -1
  239. package/src/v2/components/chat/__tests__/CopilotSidebarView.position.test.ts +32 -8
  240. package/src/v2/components/chat/__tests__/CopilotSidebarView.test.ts +2 -1
  241. package/src/v2/components/chat/__tests__/StreamingMarkdownDefault.test.ts +54 -0
  242. package/src/v2/components/chat/audioRecorder.ts +4 -7
  243. package/src/v2/components/chat/copilotChatToolCallItemRender.ts +25 -90
  244. package/src/v2/components/chat/forwarded-slots.ts +17 -0
  245. package/src/v2/components/chat/index.ts +0 -1
  246. package/src/v2/components/chat/inspector-shortcuts.ts +10 -16
  247. package/src/v2/components/chat/message-feedback.ts +92 -195
  248. package/src/v2/components/chat/tool-call-display-context.ts +6 -22
  249. package/src/v2/components/chat/tool-call-group-parts.ts +47 -108
  250. package/src/v2/components/chat/turn-work.ts +0 -9
  251. package/src/v2/components/chat/types.ts +12 -4
  252. package/src/v2/components/chat/use-chat-labels.ts +16 -0
  253. package/src/v2/components/chat/use-copy-feedback.ts +21 -0
  254. package/src/v2/components/chat/use-lightbox.ts +15 -33
  255. package/src/v2/components/icons/__tests__/icons.test.ts +72 -68
  256. package/src/v2/components/icons/index.ts +109 -27
  257. package/src/v2/hooks/__tests__/use-agent-error-state.test.ts +5 -3
  258. package/src/v2/hooks/__tests__/use-agent-stability.test.ts +25 -4
  259. package/src/v2/hooks/__tests__/use-agent-throttle.test.ts +5 -1
  260. package/src/v2/hooks/__tests__/use-agent.test.ts +6 -3
  261. package/src/v2/hooks/__tests__/use-component.test.ts +21 -0
  262. package/src/v2/hooks/__tests__/use-configure-suggestions.test.ts +30 -1
  263. package/src/v2/hooks/__tests__/use-default-render-tool.test.ts +10 -10
  264. package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +66 -1
  265. package/src/v2/hooks/__tests__/use-human-in-the-loop.e2e.test.ts +6 -1
  266. package/src/v2/hooks/__tests__/use-human-in-the-loop.test.ts +187 -12
  267. package/src/v2/hooks/__tests__/use-interrupt.test.ts +97 -0
  268. package/src/v2/hooks/__tests__/use-render-activity-message.test.ts +106 -0
  269. package/src/v2/hooks/__tests__/use-render-tool.test.ts +3 -6
  270. package/src/v2/hooks/__tests__/use-threads.test.ts +48 -6
  271. package/src/v2/hooks/__tests__/zod-regression.test.ts +5 -4
  272. package/src/v2/hooks/use-agent-context.ts +4 -10
  273. package/src/v2/hooks/use-agent.ts +86 -290
  274. package/src/v2/hooks/use-attachments.ts +48 -168
  275. package/src/v2/hooks/use-capabilities.ts +2 -7
  276. package/src/v2/hooks/use-component.ts +7 -4
  277. package/src/v2/hooks/use-configure-suggestions.ts +29 -220
  278. package/src/v2/hooks/use-default-render-tool.ts +31 -152
  279. package/src/v2/hooks/use-frontend-tool.ts +15 -25
  280. package/src/v2/hooks/use-human-in-the-loop.ts +11 -80
  281. package/src/v2/hooks/use-interrupt.ts +29 -308
  282. package/src/v2/hooks/use-keyboard-height.ts +17 -40
  283. package/src/v2/hooks/use-pin-to-send.ts +15 -99
  284. package/src/v2/hooks/use-render-activity-message.ts +35 -57
  285. package/src/v2/hooks/use-render-custom-messages.ts +24 -88
  286. package/src/v2/hooks/use-render-tool.ts +2 -4
  287. package/src/v2/hooks/use-suggestions.ts +17 -36
  288. package/src/v2/hooks/use-threads.ts +49 -288
  289. package/src/v2/lib/__tests__/shallow-stable.test.ts +54 -0
  290. package/src/v2/lib/__tests__/vue-core-renderers.test.ts +42 -0
  291. package/src/v2/lib/processPartialHtml.ts +6 -21
  292. package/src/v2/lib/shallow-stable.ts +2 -16
  293. package/src/v2/lib/vue-core.ts +90 -85
  294. package/src/v2/providers/CopilotChatConfigurationProvider.vue +48 -186
  295. package/src/v2/providers/CopilotKitProvider.types.ts +12 -132
  296. package/src/v2/providers/CopilotKitProvider.vue +291 -641
  297. package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.test.ts +22 -2
  298. package/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.ts +38 -2
  299. package/src/v2/providers/__tests__/CopilotKitProvider.config.test.ts +124 -0
  300. package/src/v2/providers/__tests__/CopilotKitProvider.headersAtSendTime.test.ts +3 -3
  301. package/src/v2/providers/__tests__/CopilotKitProvider.learning.test.ts +3 -1
  302. package/src/v2/providers/__tests__/CopilotKitProvider.sandboxFunctions.test.ts +4 -1
  303. package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +88 -28
  304. package/src/v2/providers/chat-configuration-store-key.ts +9 -0
  305. package/src/v2/providers/markdown-renderer.ts +8 -2
  306. package/src/v2/providers/types.ts +3 -49
  307. package/src/v2/providers/use-inspector-thread-override.ts +22 -80
  308. package/src/v2/types/__tests__/defineToolCallRenderer.test.ts +28 -33
  309. package/src/v2/types/defineToolCallRenderer.ts +7 -6
  310. package/src/v2/types/human-in-the-loop.ts +8 -32
  311. package/src/v2/types/interrupt.ts +7 -31
  312. package/src/v2/types/vue-activity-message-renderer.ts +24 -15
  313. package/src/v2/types/vue-custom-message-renderer.ts +12 -16
  314. package/src/v2/types/vue-tool-call-renderer.ts +23 -38
  315. package/tsconfig.json +0 -1
  316. package/vite.config.ts +8 -5
  317. package/vitest.config.ts +12 -7
  318. package/dist/v2/components/chat/BasicMarkdown.vue.d.ts +0 -9
  319. package/dist/v2/components/chat/BasicMarkdown.vue.d.ts.map +0 -1
  320. package/dist/v2/components/chat/normalize-auto-scroll.d.ts +0 -3
  321. package/dist/v2/components/chat/normalize-auto-scroll.d.ts.map +0 -1
  322. package/dist/v2/components/chat/tool-call-layout.d.ts +0 -115
  323. package/dist/v2/components/chat/tool-call-layout.d.ts.map +0 -1
  324. package/dist/v2/lib/is-mobile-viewport.d.ts +0 -15
  325. package/dist/v2/lib/is-mobile-viewport.d.ts.map +0 -1
  326. package/dist/v2/lib/message-feedback.d.ts +0 -33
  327. package/dist/v2/lib/message-feedback.d.ts.map +0 -1
  328. package/dist/v2/lib/transcription-client.d.ts +0 -19
  329. package/dist/v2/lib/transcription-client.d.ts.map +0 -1
  330. package/src/v2/components/__tests__/A2UICatalogContext.test.ts +0 -63
  331. package/src/v2/components/a2ui/__tests__/A2UIRecoveryStates.test.ts +0 -175
  332. package/src/v2/components/chat/BasicMarkdown.vue +0 -160
  333. package/src/v2/components/chat/__tests__/BasicMarkdown.test.ts +0 -69
  334. package/src/v2/components/chat/__tests__/normalize-auto-scroll.test.ts +0 -39
  335. package/src/v2/components/chat/normalize-auto-scroll.ts +0 -17
  336. package/src/v2/components/chat/tool-call-layout.ts +0 -304
  337. package/src/v2/lib/__tests__/is-mobile-viewport.test.ts +0 -48
  338. package/src/v2/lib/__tests__/message-feedback.test.ts +0 -152
  339. package/src/v2/lib/__tests__/processPartialHtml.test.ts +0 -84
  340. package/src/v2/lib/__tests__/transcription-client.test.ts +0 -67
  341. package/src/v2/lib/is-mobile-viewport.ts +0 -23
  342. package/src/v2/lib/message-feedback.ts +0 -120
  343. package/src/v2/lib/transcription-client.ts +0 -151
@@ -347,6 +347,32 @@ describe("useInterrupt", () => {
347
347
  expect(wrapper.get("[data-testid=interrupt-state]").text()).toBe("idle");
348
348
  });
349
349
 
350
+ it("treats a throwing enabled predicate as disabled instead of crashing", async () => {
351
+ vi.spyOn(console, "error").mockImplementation(() => {});
352
+ const wrapper = mountHarness({
353
+ enabled: () => {
354
+ throw new Error("predicate");
355
+ },
356
+ });
357
+ emitInterrupt("hidden");
358
+ await nextTick();
359
+ expect(wrapper.get("[data-testid=interrupt-state]").text()).toBe("idle");
360
+ });
361
+
362
+ it("shows the interrupt with a null result when the handler throws synchronously", async () => {
363
+ vi.spyOn(console, "error").mockImplementation(() => {});
364
+ const wrapper = mountHarness({
365
+ handler: () => {
366
+ throw new Error("handler");
367
+ },
368
+ });
369
+ emitInterrupt("visible");
370
+ await nextTick();
371
+ expect(wrapper.get("[data-testid=interrupt-state]").text()).toBe(
372
+ "no-result:visible",
373
+ );
374
+ });
375
+
350
376
  it("keeps the latest interrupt when multiple interrupts arrive within one run", async () => {
351
377
  const wrapper = mountHarness({ renderInChat: false });
352
378
 
@@ -412,6 +438,77 @@ describe("useInterrupt", () => {
412
438
  handlers.onRunFinalized?.();
413
439
  }
414
440
 
441
+ it("picks up the agent's pending interrupts when it mounts", async () => {
442
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
443
+ (mockAgent as any).pendingInterrupts = [INT];
444
+ const wrapper = mountStandardHarness();
445
+ await nextTick();
446
+ expect(wrapper.find("[data-testid=active]").exists()).toBe(true);
447
+ });
448
+
449
+ it("appends a tool result for a frontend tool-call interrupt before resuming", async () => {
450
+ const addMessage = vi.fn();
451
+ Object.assign(mockAgent, { messages: [], addMessage });
452
+ const TOOL_INT: Interrupt = {
453
+ id: "tool-int",
454
+ reason: "tool_call",
455
+ toolCallId: "call-1",
456
+ };
457
+ const wrapper = mountStandardHarness();
458
+ fireStandardInterrupt([TOOL_INT]);
459
+ await nextTick();
460
+
461
+ await wrapper.get("[data-testid=resolve-btn]").trigger("click");
462
+
463
+ expect(addMessage).toHaveBeenCalledWith(
464
+ expect.objectContaining({
465
+ role: "tool",
466
+ toolCallId: "call-1",
467
+ content: JSON.stringify({ ok: true }),
468
+ }),
469
+ );
470
+ expect(runAgentMock).toHaveBeenCalledWith({
471
+ agent: mockAgent,
472
+ resume: [
473
+ {
474
+ interruptId: "tool-int",
475
+ status: "resolved",
476
+ payload: { ok: true },
477
+ },
478
+ ],
479
+ });
480
+ });
481
+
482
+ it("resumes when the only expired interrupt was cancelled", async () => {
483
+ const EXPIRED: Interrupt = {
484
+ id: "old",
485
+ reason: "confirmation",
486
+ expiresAt: "2000-01-01T00:00:00.000Z",
487
+ };
488
+ let api: ReturnType<typeof useInterrupt> | undefined;
489
+ mount(
490
+ defineComponent({
491
+ setup() {
492
+ api = useInterrupt({ renderInChat: false });
493
+ return () => null;
494
+ },
495
+ }),
496
+ );
497
+ fireStandardInterrupt([EXPIRED, INT]);
498
+ await nextTick();
499
+
500
+ await api!.cancel("old");
501
+ await api!.resolve("yes", INT.id);
502
+
503
+ expect(runAgentMock).toHaveBeenCalledWith({
504
+ agent: mockAgent,
505
+ resume: [
506
+ { interruptId: "old", status: "cancelled" },
507
+ { interruptId: INT.id, status: "resolved", payload: "yes" },
508
+ ],
509
+ });
510
+ });
511
+
415
512
  it("resolveInterrupt resumes with a resolved ResumeEntry", async () => {
416
513
  runAgentMock.mockResolvedValue({ result: undefined, newMessages: [] });
417
514
  const wrapper = mountStandardHarness();
@@ -0,0 +1,106 @@
1
+ import {
2
+ afterEach,
3
+ beforeEach,
4
+ describe,
5
+ expect,
6
+ expectTypeOf,
7
+ it,
8
+ vi,
9
+ } from "vitest";
10
+ import { defineComponent, h, toRaw } from "vue";
11
+ import { z } from "zod";
12
+ import type { ActivityMessage } from "@ag-ui/core";
13
+ import { useRenderActivityMessage } from "../use-render-activity-message";
14
+ import type {
15
+ VueActivityMessageRenderer,
16
+ VueActivityMessageRendererProps,
17
+ } from "../../types";
18
+ import { renderWithCopilotKit } from "../../__tests__/utils/mount";
19
+
20
+ const ProgressRenderer = defineComponent({
21
+ props: { content: { type: Object, required: true } },
22
+ setup: () => () => null,
23
+ });
24
+
25
+ const progressSchema = z.object({
26
+ label: z.string(),
27
+ percent: z.number().default(0),
28
+ });
29
+
30
+ // A zod schema is a Standard Schema, so it fits the `content` field, and the
31
+ // renderer's content type is the schema's output type.
32
+ const progressRenderer = {
33
+ activityType: "progress",
34
+ content: progressSchema,
35
+ render: ProgressRenderer,
36
+ } satisfies VueActivityMessageRenderer<z.output<typeof progressSchema>>;
37
+
38
+ function activityMessage(content: Record<string, unknown>): ActivityMessage {
39
+ return {
40
+ id: "activity-1",
41
+ role: "activity",
42
+ activityType: "progress",
43
+ content,
44
+ };
45
+ }
46
+
47
+ function renderWithProgressRenderer() {
48
+ let helpers: ReturnType<typeof useRenderActivityMessage> | undefined;
49
+ const Probe = defineComponent({
50
+ setup() {
51
+ helpers = useRenderActivityMessage();
52
+ return () => null;
53
+ },
54
+ });
55
+
56
+ renderWithCopilotKit(() => h(Probe), {
57
+ providerProps: { renderActivityMessages: [progressRenderer] },
58
+ });
59
+
60
+ if (!helpers) throw new Error("useRenderActivityMessage did not run");
61
+ return helpers;
62
+ }
63
+
64
+ describe("useRenderActivityMessage", () => {
65
+ let consoleWarnSpy: ReturnType<typeof vi.spyOn>;
66
+
67
+ beforeEach(() => {
68
+ consoleWarnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
69
+ });
70
+
71
+ afterEach(() => {
72
+ consoleWarnSpy.mockRestore();
73
+ });
74
+
75
+ it("types a zod content schema's output as the render props content", () => {
76
+ type Props = VueActivityMessageRendererProps<
77
+ z.output<typeof progressSchema>
78
+ >;
79
+ expectTypeOf<Props["content"]>().toEqualTypeOf<{
80
+ label: string;
81
+ percent: number;
82
+ }>();
83
+ });
84
+
85
+ it("passes the zod schema's parsed output to the renderer", () => {
86
+ const { renderActivityMessage } = renderWithProgressRenderer();
87
+
88
+ const result = renderActivityMessage(activityMessage({ label: "Upload" }));
89
+
90
+ // The provider stores renderers in reactive state, so compare the raw value.
91
+ expect(toRaw(result?.renderer)).toBe(ProgressRenderer);
92
+ expect(result?.props.content).toEqual({ label: "Upload", percent: 0 });
93
+ });
94
+
95
+ it("returns null and warns when the content fails the schema", () => {
96
+ const { renderActivityMessage } = renderWithProgressRenderer();
97
+
98
+ const result = renderActivityMessage(activityMessage({ label: 42 }));
99
+
100
+ expect(result).toBeNull();
101
+ expect(consoleWarnSpy).toHaveBeenCalledWith(
102
+ "[CopilotKit] Failed to parse content for activity message 'progress':",
103
+ expect.any(Array),
104
+ );
105
+ });
106
+ });
@@ -93,7 +93,7 @@ describe("useRenderTool", () => {
93
93
  expect(typeof renderer?.render).toBe("function");
94
94
  });
95
95
 
96
- it("registers wildcard renderer and defaults parameters schema to z.any", () => {
96
+ it("registers wildcard renderer and defaults parameters to a schema that accepts any value", () => {
97
97
  const core = createMockCore();
98
98
  mockUseCopilotKit.mockReturnValue({ copilotkit: { value: core } });
99
99
 
@@ -118,11 +118,8 @@ describe("useRenderTool", () => {
118
118
  const renderer = core.renderToolCalls.find((item) => item.name === "*");
119
119
  expect(renderer).toBeDefined();
120
120
  expect(typeof renderer?.render).toBe("function");
121
- const wildcardArgs = renderer?.args as
122
- | { safeParse: (v: unknown) => { success: boolean } }
123
- | undefined;
124
- expect(wildcardArgs).toBeDefined();
125
- expect(wildcardArgs!.safeParse({ arbitrary: true }).success).toBe(true);
121
+ const result = renderer?.args["~standard"].validate({ arbitrary: true });
122
+ expect(result).toEqual({ value: { arbitrary: true } });
126
123
  });
127
124
 
128
125
  it("accepts a Vue component renderer", () => {
@@ -4,6 +4,19 @@ import type { Ref } from "vue";
4
4
  import { describe, expect, it, beforeEach, vi } from "vitest";
5
5
  import { useCopilotKit } from "../../providers/useCopilotKit";
6
6
 
7
+ /** Core's `ɵruntimeInfo` snapshot, built from a fake core's runtime fields. */
8
+ function runtimeInfoOf(core: {
9
+ runtimeConnectionStatus: CopilotKitCoreRuntimeConnectionStatus;
10
+ threadEndpoints?: unknown;
11
+ intelligence?: unknown;
12
+ }) {
13
+ return {
14
+ status: core.runtimeConnectionStatus,
15
+ threadEndpoints: core.threadEndpoints,
16
+ intelligence: core.intelligence,
17
+ };
18
+ }
19
+
7
20
  type ThreadRecord = {
8
21
  id: string;
9
22
  organizationId: string;
@@ -54,7 +67,8 @@ function compareThreadsByActivity(left: ThreadRecord, right: ThreadRecord) {
54
67
  return rightKey.localeCompare(leftKey);
55
68
  }
56
69
 
57
- vi.mock("@copilotkit/core", () => {
70
+ vi.mock("@copilotkit/core", async (importOriginal) => {
71
+ const actual = await importOriginal<typeof import("@copilotkit/core")>();
58
72
  class MockChannel {
59
73
  topic: string;
60
74
  left = false;
@@ -118,6 +132,16 @@ vi.mock("@copilotkit/core", () => {
118
132
  private listeners = new Set<() => void>();
119
133
  private socket: MockSocket | null = null;
120
134
 
135
+ readonly selectors = {
136
+ threads: (state: ThreadState) => state.threads,
137
+ isLoading: (state: ThreadState) => state.isLoading,
138
+ error: (state: ThreadState) => state.error,
139
+ fetchMoreError: (state: ThreadState) => state.fetchMoreError,
140
+ hasNextPage: (state: ThreadState) => state.hasNextPage,
141
+ isFetchingNextPage: (state: ThreadState) => state.isFetchingNextPage,
142
+ isMutating: (state: ThreadState) => state.isMutating,
143
+ };
144
+
121
145
  start(): void {}
122
146
 
123
147
  stop(): void {
@@ -317,6 +341,10 @@ vi.mock("@copilotkit/core", () => {
317
341
  return this.state;
318
342
  }
319
343
 
344
+ getServerState(): ThreadState {
345
+ return { ...this.state, threads: [] };
346
+ }
347
+
320
348
  select<T>(selector: (state: ThreadState) => T) {
321
349
  return {
322
350
  subscribe: (callback: () => void) => {
@@ -357,6 +385,8 @@ vi.mock("@copilotkit/core", () => {
357
385
  ɵselectHasNextPage: select((state) => state.hasNextPage),
358
386
  ɵselectIsFetchingNextPage: select((state) => state.isFetchingNextPage),
359
387
  ɵselectIsMutating: select((state) => state.isMutating),
388
+ // The real view model, driving the mock store above.
389
+ ɵThreadsController: actual.ɵThreadsController,
360
390
  };
361
391
  });
362
392
 
@@ -394,6 +424,7 @@ const supportedThreadEndpoints: ThreadEndpointRuntimeInfo = {
394
424
 
395
425
  type MockCopilotKit = {
396
426
  runtimeUrl: string | undefined;
427
+ readonly ɵruntimeInfo: unknown;
397
428
  runtimeConnectionStatus: CopilotKitCoreRuntimeConnectionStatus;
398
429
  headers: Record<string, string>;
399
430
  /**
@@ -417,6 +448,9 @@ function setupCopilotKit(
417
448
  ) {
418
449
  const copilotkit = ref<MockCopilotKit>({
419
450
  runtimeUrl,
451
+ get ɵruntimeInfo() {
452
+ return runtimeInfoOf(this);
453
+ },
420
454
  runtimeConnectionStatus,
421
455
  headers: { Authorization: "Bearer test-token" },
422
456
  ɵheadersGeneration: 0,
@@ -965,6 +999,9 @@ describe("useThreads", () => {
965
999
  // exactly one list fetch (+ one subscribe after it lands).
966
1000
  copilotkit.value = {
967
1001
  ...copilotkit.value,
1002
+ get ɵruntimeInfo() {
1003
+ return runtimeInfoOf(this);
1004
+ },
968
1005
  runtimeConnectionStatus:
969
1006
  CopilotKitCoreRuntimeConnectionStatus.Connected,
970
1007
  intelligence: { wsUrl: "ws://localhost:4000/client" },
@@ -1020,6 +1057,9 @@ describe("useThreads", () => {
1020
1057
 
1021
1058
  copilotkit.value = {
1022
1059
  ...copilotkit.value,
1060
+ get ɵruntimeInfo() {
1061
+ return runtimeInfoOf(this);
1062
+ },
1023
1063
  runtimeConnectionStatus:
1024
1064
  CopilotKitCoreRuntimeConnectionStatus.Disconnected,
1025
1065
  };
@@ -1216,8 +1256,9 @@ describe("useThreads", () => {
1216
1256
 
1217
1257
  expect(fetchMock).not.toHaveBeenCalled();
1218
1258
  expect(getResult().threads.value).toEqual([]);
1219
- const lastDispatched = getDispatchedContexts().at(-1);
1220
- expect(lastDispatched).toBeNull();
1259
+ // Nothing was ever sent, so nothing is cleared either (no extra
1260
+ // queued list fetch).
1261
+ expect(getDispatchedContexts()).toEqual([]);
1221
1262
  // A disabled consumer must not be stuck in a permanent loading state:
1222
1263
  // preConnectLoading must factor in `enabled`, otherwise isLoading would
1223
1264
  // stay true forever since hasDispatchedContext never gets set.
@@ -1240,7 +1281,7 @@ describe("useThreads", () => {
1240
1281
  // Disabled: inert, not loading, no fetch.
1241
1282
  expect(getResult().isLoading.value).toBe(false);
1242
1283
  expect(fetchMock).not.toHaveBeenCalled();
1243
- expect(getDispatchedContexts().at(-1)).toBeNull();
1284
+ expect(getDispatchedContexts().filter(Boolean)).toEqual([]);
1244
1285
 
1245
1286
  // Re-enable: the pre-connect loading indicator must re-arm (i.e.
1246
1287
  // hasDispatchedContext was reset to false on disable) so consumers see
@@ -1343,8 +1384,9 @@ describe("useThreads", () => {
1343
1384
 
1344
1385
  expect(fetchMock).not.toHaveBeenCalled();
1345
1386
  expect(getResult().threads.value).toEqual([]);
1346
- const lastDispatched = getDispatchedContexts().at(-1);
1347
- expect(lastDispatched).toBeNull();
1387
+ // Nothing was ever sent, so nothing is cleared either (no extra
1388
+ // queued list fetch).
1389
+ expect(getDispatchedContexts()).toEqual([]);
1348
1390
  expect(getResult().error.value?.message).toBe(
1349
1391
  "Thread endpoints are not available on this CopilotKit runtime",
1350
1392
  );
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Covers:
6
6
  * 1. useRenderTool with complex Zod schemas
7
- * 2. defineToolCallRenderer with Zod (named + wildcard default z.any())
7
+ * 2. defineToolCallRenderer with Zod (named + wildcard default schema)
8
8
  * 3. useComponent with Zod schemas
9
9
  * 4. The registered schema object is the original Zod instance (identity check)
10
10
  */
@@ -134,7 +134,7 @@ describe("useRenderTool Zod regression", () => {
134
134
  const schema = z.object({
135
135
  action: z.discriminatedUnion("type", [
136
136
  z.object({ type: z.literal("search"), query: z.string() }),
137
- z.object({ type: z.literal("navigate"), url: z.string().url() }),
137
+ z.object({ type: z.literal("navigate"), url: z.url() }),
138
138
  ]),
139
139
  });
140
140
 
@@ -196,14 +196,15 @@ describe("useRenderTool Zod regression", () => {
196
196
  });
197
197
 
198
198
  describe("defineToolCallRenderer Zod regression", () => {
199
- it("wildcard tool defaults to z.any() for args", () => {
199
+ it("wildcard tool defaults to a schema that accepts any value", () => {
200
200
  const renderer = defineToolCallRenderer({
201
201
  name: "*",
202
202
  render: () => "wildcard",
203
203
  });
204
204
 
205
205
  expect(renderer.name).toBe("*");
206
- expect((renderer.args as any)["~standard"].vendor).toBe("zod");
206
+ const result = renderer.args["~standard"].validate({ city: "Paris" });
207
+ expect(result).toEqual({ value: { city: "Paris" } });
207
208
  });
208
209
 
209
210
  it("named tool with Zod args preserves schema identity", () => {
@@ -1,14 +1,10 @@
1
1
  import { computed, toValue, watch } from "vue";
2
2
  import type { MaybeRefOrGetter } from "vue";
3
+ import { ɵserializeContextValue } from "@copilotkit/core";
4
+ import type { ɵJsonSerializable } from "@copilotkit/core";
3
5
  import { useCopilotKit } from "../providers/useCopilotKit";
4
6
 
5
- export type JsonSerializable =
6
- | string
7
- | number
8
- | boolean
9
- | null
10
- | JsonSerializable[]
11
- | { [key: string]: JsonSerializable };
7
+ export type JsonSerializable = ɵJsonSerializable;
12
8
 
13
9
  export interface AgentContextInput {
14
10
  description: MaybeRefOrGetter<string>;
@@ -35,9 +31,7 @@ export function useAgentContext(context: AgentContextInput): void {
35
31
  const resolvedValue = computed(() => toValue(context.value));
36
32
 
37
33
  const stringValue = computed(() =>
38
- typeof resolvedValue.value === "string"
39
- ? resolvedValue.value
40
- : JSON.stringify(resolvedValue.value),
34
+ ɵserializeContextValue(resolvedValue.value),
41
35
  );
42
36
 
43
37
  watch(