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

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-BZJ33B_r.cjs +113 -0
  13. package/dist/use-render-activity-message-BZJ33B_r.cjs.map +1 -0
  14. package/dist/use-render-activity-message-DrR407LQ.js +15901 -0
  15. package/dist/use-render-activity-message-DrR407LQ.js.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
@@ -1,69 +1,20 @@
1
- import { defineComponent, h, onBeforeUnmount, ref, watch } from "vue";
2
- import type { PropType, VNodeChild } from "vue";
3
- import { z } from "zod";
1
+ import { h } from "vue";
2
+ import type { Component, VNodeChild } from "vue";
3
+ import { ɵA2UI_LIFECYCLE_TEXT, ɵA2UI_SKELETON_ROWS } from "@copilotkit/core";
4
+ import type {
5
+ ɵA2UIActivitySnapshot,
6
+ ɵA2UIProgressPhase,
7
+ ɵA2UIRecoveryOptions,
8
+ ɵA2UISkeletonPart,
9
+ } from "@copilotkit/core";
4
10
 
5
11
  /**
6
- * Shared pre-paint lifecycle states for the A2UI surface renderer, ported from
7
- * React's `A2UIRecoveryStates`.
8
- *
9
- * The A2UI middleware drives the WHOLE generative-UI lifecycle on a single
10
- * `a2ui-surface` activity (one stable messageId, `replace: true`), so the states
11
- * below swap IN PLACE and the painted surface ultimately replaces them:
12
- *
13
- * building → animated skeleton + "Building interface" (+ optional ~N tokens)
14
- * retrying → same skeleton; once perceptible, the sub-label becomes
15
- * "Retrying generation… (N/M attempts)" (threshold-gated so a fast
16
- * transient retry never flashes), with debug detail per debugExposure
17
- * failed → a clean hard-failure card (replacing the skeleton), developer
18
- * detail tucked into an expander gated by debugExposure
19
- * painted → the surface renderer owns the UI (these states render nothing)
20
- *
21
- * Timing (`showAfterMs` / `showAfterAttempts`) and how much debug detail to
22
- * surface (`debugExposure`) are client concerns; the server can override
23
- * `debugExposure` by stamping it onto the activity content (it wins over the
24
- * client option).
25
- */
26
- export type A2UIRecoveryRendererOptions = {
27
- /** Delay (ms) before the "Retrying…" sub-label becomes visible. Default 2000. */
28
- showAfterMs?: number;
29
- /** Show the "Retrying…" sub-label immediately once `attempt` reaches this. Default 2. */
30
- showAfterAttempts?: number;
31
- /** How much retry/debug detail to surface. Default "collapsed". */
32
- debugExposure?: "hidden" | "collapsed" | "verbose";
33
- };
34
-
35
- export type DebugExposure = "hidden" | "collapsed" | "verbose";
36
-
37
- /**
38
- * The pre-paint lifecycle fields the middleware stamps onto the `a2ui-surface`
39
- * activity content (alongside `a2ui_operations` on paint).
12
+ * Pre-paint recovery and loading options: how long before the "Retrying…"
13
+ * label appears, and how much retry and debug detail to show. Core's
14
+ * `ɵA2UIActivityController` owns the rules; this module only draws its
15
+ * snapshot.
40
16
  */
41
- export const A2UILifecycleFields = {
42
- status: z.enum(["building", "retrying", "failed"]).optional(),
43
- attempt: z.number().optional(),
44
- maxAttempts: z.number().optional(),
45
- progressTokens: z.number().optional(),
46
- error: z.string().optional(),
47
- errors: z.array(z.any()).optional(),
48
- attempts: z.array(z.any()).optional(),
49
- // Server-side knob (stamped by the A2UI middleware).
50
- debugExposure: z.enum(["hidden", "collapsed", "verbose"]).optional(),
51
- };
52
-
53
- /** Server-stamped debugExposure wins; else the client option. */
54
- export function resolveDebugExposure(
55
- content: any,
56
- optionDebugExposure: DebugExposure,
57
- ): DebugExposure {
58
- return content?.debugExposure ?? optionDebugExposure;
59
- }
60
-
61
- const tokensOf = (content: any): number | undefined =>
62
- typeof content?.progressTokens === "number"
63
- ? content.progressTokens
64
- : undefined;
65
-
66
- // --- Skeleton + primitives ---------------------------------------------------
17
+ export type A2UIRecoveryRendererOptions = ɵA2UIRecoveryOptions;
67
18
 
68
19
  const dot = () =>
69
20
  h("div", {
@@ -76,69 +27,30 @@ const dot = () =>
76
27
  },
77
28
  });
78
29
 
79
- const spacer = () => h("div", { style: { width: "12px" } });
80
-
81
- const bar = (
82
- w: number,
83
- ht: number,
84
- bg: string,
85
- anim?: number,
86
- opacity?: number,
87
- transition?: string,
88
- ) =>
89
- h("div", {
30
+ function skeletonPart(part: ɵA2UISkeletonPart) {
31
+ if (part === "dot") return dot();
32
+ if (part === "spacer") return h("div", { style: { width: "12px" } });
33
+ return h("div", {
90
34
  style: {
91
- width: `${w}px`,
92
- height: `${ht}px`,
35
+ width: `${String(part.w)}px`,
36
+ height: "7px",
93
37
  borderRadius: "9999px",
94
- backgroundColor: bg,
95
- ...(anim !== undefined
96
- ? {
97
- animation: `cpk-a2ui-fade 2.4s ease-in-out ${anim}s infinite`,
98
- }
99
- : {}),
100
- ...(opacity !== undefined ? { opacity } : {}),
101
- ...(transition ? { transition } : {}),
38
+ backgroundColor: part.bg,
39
+ animation: `cpk-a2ui-fade 2.4s ease-in-out ${String(part.anim)}s infinite`,
102
40
  },
103
41
  });
104
-
105
- const row = (show: boolean, delay: number, children: VNodeChild[]) =>
106
- h(
107
- "div",
108
- {
109
- style: {
110
- display: "flex",
111
- alignItems: "center",
112
- gap: "6px",
113
- opacity: show ? 1 : 0,
114
- transition: `opacity 0.4s ${delay}s`,
115
- },
116
- },
117
- children,
118
- );
42
+ }
119
43
 
120
44
  /**
121
45
  * Animated wireframe skeleton with a label, an optional live token count, and
122
- * optional debug detail below it. The `tokens` count drives a progressive
123
- * reveal of skeleton rows.
46
+ * optional debug detail below it. `phase` reveals the rows.
124
47
  */
125
- export function renderA2UIGeneratingSkeleton(
48
+ function renderA2UIGeneratingSkeleton(
126
49
  label: string,
127
- tokens?: number,
128
- children?: VNodeChild[],
129
- ): VNodeChild {
130
- // No count yet → show the fuller skeleton rather than an empty box.
131
- const phase =
132
- tokens == null
133
- ? 3
134
- : tokens < 50
135
- ? 0
136
- : tokens < 200
137
- ? 1
138
- : tokens < 400
139
- ? 2
140
- : 3;
141
-
50
+ tokens: number | undefined,
51
+ phase: ɵA2UIProgressPhase,
52
+ children: VNodeChild[],
53
+ ) {
142
54
  return h("div", { style: { margin: "12px 0", maxWidth: "320px" } }, [
143
55
  h(
144
56
  "div",
@@ -154,7 +66,6 @@ export function renderA2UIGeneratingSkeleton(
154
66
  },
155
67
  },
156
68
  [
157
- // Top bar
158
69
  h(
159
70
  "div",
160
71
  {
@@ -171,57 +82,37 @@ export function renderA2UIGeneratingSkeleton(
171
82
  dot(),
172
83
  dot(),
173
84
  ]),
174
- bar(
175
- 64,
176
- 6,
177
- "#e4e4e7",
178
- undefined,
179
- phase >= 1 ? 1 : 0.4,
180
- "opacity 0.5s",
181
- ),
85
+ h("div", {
86
+ style: {
87
+ width: "64px",
88
+ height: "6px",
89
+ borderRadius: "9999px",
90
+ backgroundColor: "#e4e4e7",
91
+ opacity: phase >= 1 ? 1 : 0.4,
92
+ transition: "opacity 0.5s",
93
+ },
94
+ }),
182
95
  ],
183
96
  ),
184
- // Skeleton lines
185
- h("div", { style: { display: "grid", gap: "7px" } }, [
186
- row(phase >= 0, 0, [
187
- bar(36, 7, "rgba(147,197,253,0.7)", 0),
188
- bar(80, 7, "rgba(219,234,254,0.8)", 0.2),
189
- ]),
190
- row(phase >= 0, 0.1, [
191
- spacer(),
192
- dot(),
193
- bar(100, 7, "rgba(24,24,27,0.2)", 0.3),
194
- ]),
195
- row(phase >= 1, 0.15, [
196
- spacer(),
197
- bar(48, 7, "rgba(24,24,27,0.15)", 0.1),
198
- bar(40, 7, "rgba(153,246,228,0.6)", 0.5),
199
- bar(56, 7, "rgba(147,197,253,0.6)", 0.3),
200
- ]),
201
- row(phase >= 1, 0.2, [
202
- spacer(),
203
- dot(),
204
- bar(60, 7, "rgba(24,24,27,0.15)", 0.4),
205
- ]),
206
- row(phase >= 2, 0.25, [
207
- bar(40, 7, "rgba(153,246,228,0.5)", 0.2),
208
- dot(),
209
- bar(48, 7, "rgba(24,24,27,0.15)", 0.6),
210
- bar(64, 7, "rgba(147,197,253,0.5)", 0.1),
211
- ]),
212
- row(phase >= 2, 0.3, [
213
- bar(36, 7, "rgba(147,197,253,0.6)", 0.5),
214
- bar(36, 7, "rgba(24,24,27,0.12)", 0.7),
215
- ]),
216
- row(phase >= 3, 0.35, [
217
- dot(),
218
- bar(44, 7, "rgba(24,24,27,0.18)", 0.3),
219
- dot(),
220
- bar(56, 7, "rgba(153,246,228,0.5)", 0.8),
221
- bar(48, 7, "rgba(147,197,253,0.5)", 0.4),
222
- ]),
223
- ]),
224
- // Shimmer
97
+ h(
98
+ "div",
99
+ { style: { display: "grid", gap: "7px" } },
100
+ ɵA2UI_SKELETON_ROWS.map((row) =>
101
+ h(
102
+ "div",
103
+ {
104
+ style: {
105
+ display: "flex",
106
+ alignItems: "center",
107
+ gap: "6px",
108
+ opacity: phase >= row.phase ? 1 : 0,
109
+ transition: `opacity 0.4s ${String(row.delay)}s`,
110
+ },
111
+ },
112
+ row.parts.map(skeletonPart),
113
+ ),
114
+ ),
115
+ ),
225
116
  h("div", {
226
117
  style: {
227
118
  pointerEvents: "none",
@@ -235,7 +126,6 @@ export function renderA2UIGeneratingSkeleton(
235
126
  }),
236
127
  ],
237
128
  ),
238
- // Label
239
129
  h(
240
130
  "div",
241
131
  {
@@ -259,25 +149,22 @@ export function renderA2UIGeneratingSkeleton(
259
149
  },
260
150
  label,
261
151
  ),
262
- ...(typeof tokens === "number" && tokens > 0
263
- ? [
264
- h(
265
- "span",
266
- {
267
- style: {
268
- fontSize: "11px",
269
- color: "#d4d4d8",
270
- fontVariantNumeric: "tabular-nums",
271
- },
152
+ typeof tokens === "number" && tokens > 0
153
+ ? h(
154
+ "span",
155
+ {
156
+ style: {
157
+ fontSize: "11px",
158
+ color: "#d4d4d8",
159
+ fontVariantNumeric: "tabular-nums",
272
160
  },
273
- `~${tokens.toLocaleString()} tokens`,
274
- ),
275
- ]
276
- : []),
161
+ },
162
+ `~${tokens.toLocaleString()} tokens`,
163
+ )
164
+ : null,
277
165
  ],
278
166
  ),
279
- ...(children ?? []),
280
- // Keyframe styles
167
+ ...children,
281
168
  h(
282
169
  "style",
283
170
  `
@@ -294,151 +181,64 @@ export function renderA2UIGeneratingSkeleton(
294
181
  ]);
295
182
  }
296
183
 
297
- function renderDebugDetails(
298
- label: string,
299
- open: boolean,
300
- payload: unknown,
301
- ): VNodeChild {
302
- return h("details", { open, class: "cpk-a2ui-debug-details" }, [
303
- h("summary", { class: "cpk-a2ui-debug-details-summary" }, label),
304
- h(
305
- "pre",
306
- { class: "cpk-a2ui-debug-details-payload", style: { fontSize: "11px" } },
307
- JSON.stringify(payload, null, 2),
308
- ),
309
- ]);
310
- }
311
-
312
- // --- Lifecycle states ---------------------------------------------------------
313
-
314
- /** building: the generic skeleton + optional live token count. */
315
- export const A2UIBuildingState = defineComponent({
316
- name: "A2UIBuildingState",
317
- props: {
318
- content: { type: null as unknown as PropType<any>, default: undefined },
319
- },
320
- setup(props) {
321
- return () =>
322
- renderA2UIGeneratingSkeleton(
323
- "Building interface",
324
- tokensOf(props.content),
325
- );
326
- },
327
- });
328
-
329
184
  /**
330
- * retrying: stays the generic skeleton through fast/transient retries; only
331
- * once the retry is perceptible (after `showAfterMs`, or once `attempt`
332
- * crosses `showAfterAttempts`) does the sub-label reveal
333
- * "Retrying generation… (N/M)".
185
+ * Draws the lifecycle state of an `a2ui-surface` activity: the failure card,
186
+ * the host's loading component while building, or the skeleton.
187
+ *
188
+ * @param snapshot - The activity controller's snapshot.
189
+ * @param loadingComponent - Shown instead of the skeleton while building.
334
190
  */
335
- export const A2UIRetryingState = defineComponent({
336
- name: "A2UIRetryingState",
337
- props: {
338
- content: { type: null as unknown as PropType<any>, default: undefined },
339
- showAfterMs: { type: Number, required: true },
340
- showAfterAttempts: { type: Number, required: true },
341
- debugExposure: {
342
- type: String as PropType<DebugExposure>,
343
- required: true,
344
- },
345
- },
346
- setup(props) {
347
- const attempt = () =>
348
- typeof props.content?.attempt === "number"
349
- ? (props.content.attempt as number)
350
- : undefined;
351
- const immediate = () => {
352
- const current = attempt();
353
- return current !== undefined && current >= props.showAfterAttempts;
354
- };
355
- const revealed = ref(immediate());
356
- let timer: ReturnType<typeof setTimeout> | undefined;
357
-
358
- watch(
359
- [immediate, () => props.showAfterMs],
360
- ([isImmediate, showAfterMs]) => {
361
- clearTimeout(timer);
362
- if (isImmediate) {
363
- revealed.value = true;
364
- return;
365
- }
366
- timer = setTimeout(() => {
367
- revealed.value = true;
368
- }, showAfterMs);
369
- },
370
- { immediate: true },
371
- );
372
- onBeforeUnmount(() => clearTimeout(timer));
373
-
374
- return () => {
375
- const tokens = tokensOf(props.content);
376
- // Not yet perceptible → indistinguishable from normal building.
377
- if (!revealed.value) {
378
- return renderA2UIGeneratingSkeleton("Building interface", tokens);
379
- }
380
- const current = attempt();
381
- const maxAttempts =
382
- typeof props.content?.maxAttempts === "number"
383
- ? props.content.maxAttempts
384
- : undefined;
385
- const label =
386
- current !== undefined && maxAttempts !== undefined
387
- ? `Retrying generation… (${current}/${maxAttempts} attempts)`
388
- : "Retrying generation…";
389
- const errors = Array.isArray(props.content?.errors)
390
- ? props.content.errors
391
- : [];
392
- return renderA2UIGeneratingSkeleton(
393
- label,
394
- tokens,
395
- props.debugExposure !== "hidden" && errors.length > 0
396
- ? [
397
- renderDebugDetails(
398
- "validation issues",
399
- props.debugExposure === "verbose",
400
- { attempt: props.content?.attempt, errors },
401
- ),
402
- ]
403
- : [],
404
- );
405
- };
406
- },
407
- });
408
-
409
- /** failed: a clean hard-failure card that replaces the skeleton in place. */
410
- export const A2UIRecoveryFailure = defineComponent({
411
- name: "A2UIRecoveryFailure",
412
- props: {
413
- content: { type: null as unknown as PropType<any>, default: undefined },
414
- debugExposure: {
415
- type: String as PropType<DebugExposure>,
416
- required: true,
417
- },
418
- },
419
- setup(props) {
420
- return () =>
421
- h("div", { class: "cpk-a2ui-recovery-failure" }, [
422
- h(
423
- "div",
424
- { class: "cpk-a2ui-recovery-failure-title" },
425
- "Couldn't generate the UI",
426
- ),
191
+ export function renderA2UILifecycleState(
192
+ snapshot: ɵA2UIActivitySnapshot,
193
+ loadingComponent: Component | undefined,
194
+ ) {
195
+ const details: VNodeChild[] = snapshot.showDebugDetails
196
+ ? [
427
197
  h(
428
- "div",
429
- { class: "cpk-a2ui-recovery-failure-description" },
430
- "Something went wrong rendering this. You can keep chatting and try again.",
431
- ),
432
- props.debugExposure !== "hidden"
433
- ? renderDebugDetails(
434
- "developer details",
435
- props.debugExposure === "verbose",
198
+ "details",
199
+ { open: snapshot.debugDetailsOpen, class: "cpk-a2ui-debug-details" },
200
+ [
201
+ h(
202
+ "summary",
203
+ { class: "cpk-a2ui-debug-details-summary" },
204
+ snapshot.debugDetailsLabel,
205
+ ),
206
+ h(
207
+ "pre",
436
208
  {
437
- error: props.content?.error,
438
- attempts: props.content?.attempts,
209
+ class: "cpk-a2ui-debug-details-payload",
210
+ style: { fontSize: "11px" },
439
211
  },
440
- )
441
- : null,
442
- ]);
443
- },
444
- });
212
+ snapshot.debugPayload,
213
+ ),
214
+ ],
215
+ ),
216
+ ]
217
+ : [];
218
+ const { lifecycle } = snapshot;
219
+
220
+ if (lifecycle.status === "failed") {
221
+ return h("div", { class: "cpk-a2ui-recovery-failure" }, [
222
+ h(
223
+ "div",
224
+ { class: "cpk-a2ui-recovery-failure-title" },
225
+ ɵA2UI_LIFECYCLE_TEXT.failureTitle,
226
+ ),
227
+ h(
228
+ "div",
229
+ { class: "cpk-a2ui-recovery-failure-description" },
230
+ ɵA2UI_LIFECYCLE_TEXT.failureDescription,
231
+ ),
232
+ ...details,
233
+ ]);
234
+ }
235
+ if (lifecycle.status === "building" && loadingComponent) {
236
+ return h(loadingComponent);
237
+ }
238
+ return renderA2UIGeneratingSkeleton(
239
+ snapshot.label,
240
+ lifecycle.progressTokens,
241
+ snapshot.progressPhase,
242
+ details,
243
+ );
244
+ }
@@ -40,6 +40,7 @@ import {
40
40
  getBaseContainerStyle,
41
41
  mapJustify,
42
42
  mapAlign,
43
+ getDateTimeInputType,
43
44
  } from "./utils";
44
45
 
45
46
  // -- Helper: render a child list (arrays of { id, basePath } or string IDs) --
@@ -100,6 +101,7 @@ const Text = createVueComponent(TextApi, ({ props }) => {
100
101
  text,
101
102
  );
102
103
  case "body":
104
+ case undefined:
103
105
  default:
104
106
  return h("span", { style }, text);
105
107
  }
@@ -811,9 +813,7 @@ const DateTimeInput = createVueComponent(
811
813
  ({ props, state }) => {
812
814
  const uniqueId = state.id;
813
815
 
814
- let type = "datetime-local";
815
- if (props.enableDate && !props.enableTime) type = "date";
816
- if (!props.enableDate && props.enableTime) type = "time";
816
+ const type = getDateTimeInputType(props);
817
817
 
818
818
  const style = {
819
819
  padding: "8px",
@@ -1,67 +1,15 @@
1
1
  /**
2
- * Style utilities for Vue A2UI basic catalog components.
3
- * Mirrors the React renderer's catalog/basic/utils.ts.
2
+ * Style utilities for Vue A2UI basic catalog components, shared with the
3
+ * React and Angular renderers through `@copilotkit/a2ui-renderer/engine`.
4
4
  */
5
-
6
- import type { CSSProperties } from "vue";
7
-
8
- /** Standard leaf margin from the implementation guide. */
9
- export const LEAF_MARGIN = "8px";
10
-
11
- /** Standard internal padding for visually bounded containers. */
12
- export const CONTAINER_PADDING = "16px";
13
-
14
- /** Standard border for cards and inputs. */
15
- export const STANDARD_BORDER = "1px solid var(--a2ui-color-border, #ccc)";
16
-
17
- /** Standard border radius. */
18
- export const STANDARD_RADIUS = "8px";
19
-
20
- export const mapJustify = (j?: string): string => {
21
- switch (j) {
22
- case "center":
23
- return "center";
24
- case "end":
25
- return "flex-end";
26
- case "spaceAround":
27
- return "space-around";
28
- case "spaceBetween":
29
- return "space-between";
30
- case "spaceEvenly":
31
- return "space-evenly";
32
- case "start":
33
- return "flex-start";
34
- case "stretch":
35
- return "stretch";
36
- default:
37
- return "flex-start";
38
- }
39
- };
40
-
41
- export const mapAlign = (a?: string): string => {
42
- switch (a) {
43
- case "start":
44
- return "flex-start";
45
- case "center":
46
- return "center";
47
- case "end":
48
- return "flex-end";
49
- case "stretch":
50
- return "stretch";
51
- default:
52
- return "stretch";
53
- }
54
- };
55
-
56
- export const getBaseLeafStyle = (): CSSProperties => ({
57
- margin: LEAF_MARGIN,
58
- boxSizing: "border-box",
59
- });
60
-
61
- export const getBaseContainerStyle = (): CSSProperties => ({
62
- margin: LEAF_MARGIN,
63
- padding: CONTAINER_PADDING,
64
- border: STANDARD_BORDER,
65
- borderRadius: STANDARD_RADIUS,
66
- boxSizing: "border-box",
67
- });
5
+ export {
6
+ LEAF_MARGIN,
7
+ CONTAINER_PADDING,
8
+ STANDARD_BORDER,
9
+ STANDARD_RADIUS,
10
+ mapJustify,
11
+ mapAlign,
12
+ getBaseLeafStyle,
13
+ getBaseContainerStyle,
14
+ getDateTimeInputType,
15
+ } from "@copilotkit/a2ui-renderer/engine";
@@ -1,30 +1,23 @@
1
- import { z } from "zod";
1
+ import * as z from "zod";
2
+ import {
3
+ ɵA2UI_DEFAULT_SURFACE_ID,
4
+ ɵA2UI_SURFACE_ACTIVITY_TYPE,
5
+ ɵgetA2UIOperationSurfaceId,
6
+ } from "@copilotkit/core";
7
+ import type { ɵA2UIOperation } from "@copilotkit/core";
2
8
 
3
- export type A2UIOperation = Record<string, unknown>;
9
+ export type A2UIOperation = ɵA2UIOperation;
4
10
 
5
- export const A2UISurfaceActivityType = "a2ui-surface";
11
+ export const A2UISurfaceActivityType = ɵA2UI_SURFACE_ACTIVITY_TYPE;
6
12
 
7
13
  export const A2UIActivityContentSchema = z.object({
8
14
  operations: z.array(z.record(z.string(), z.unknown())),
9
15
  });
10
16
 
11
- export function getOperationSurfaceId(operation: A2UIOperation): string {
12
- const surfaceId =
13
- (operation.surfaceId as string | undefined) ??
14
- ((operation.beginRendering as { surfaceId?: string } | undefined)
15
- ?.surfaceId as string | undefined) ??
16
- ((operation.surfaceUpdate as { surfaceId?: string } | undefined)
17
- ?.surfaceId as string | undefined) ??
18
- ((operation.dataModelUpdate as { surfaceId?: string } | undefined)
19
- ?.surfaceId as string | undefined) ??
20
- ((operation.deleteSurface as { surfaceId?: string } | undefined)
21
- ?.surfaceId as string | undefined) ??
22
- ((operation.createSurface as { surfaceId?: string } | undefined)
23
- ?.surfaceId as string | undefined) ??
24
- ((operation.updateComponents as { surfaceId?: string } | undefined)
25
- ?.surfaceId as string | undefined) ??
26
- ((operation.updateDataModel as { surfaceId?: string } | undefined)
27
- ?.surfaceId as string | undefined);
28
-
29
- return surfaceId ?? "default";
17
+ /**
18
+ * The surface an operation addresses: the id nested in the operation wins
19
+ * over a top-level `surfaceId` (OSS-1048); "default" when it names none.
20
+ */
21
+ export function getOperationSurfaceId(operation: A2UIOperation) {
22
+ return ɵgetA2UIOperationSurfaceId(operation) ?? ɵA2UI_DEFAULT_SURFACE_ID;
30
23
  }