@copilotkit/vue 1.57.1

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 (437) hide show
  1. package/AGENTS.md +50 -0
  2. package/CHANGELOG.md +13 -0
  3. package/PARITY.md +434 -0
  4. package/README.md +396 -0
  5. package/dist/components/copilot-provider/CopilotKit.vue.d.ts +20 -0
  6. package/dist/components/copilot-provider/CopilotKit.vue.d.ts.map +1 -0
  7. package/dist/components/copilot-provider/index.d.ts +3 -0
  8. package/dist/components/copilot-provider/index.d.ts.map +1 -0
  9. package/dist/components/copilot-provider/types.d.ts +22 -0
  10. package/dist/components/copilot-provider/types.d.ts.map +1 -0
  11. package/dist/hooks/index.d.ts +7 -0
  12. package/dist/hooks/index.d.ts.map +1 -0
  13. package/dist/hooks/use-copilot-action.d.ts +27 -0
  14. package/dist/hooks/use-copilot-action.d.ts.map +1 -0
  15. package/dist/hooks/use-copilot-readable.d.ts +20 -0
  16. package/dist/hooks/use-copilot-readable.d.ts.map +1 -0
  17. package/dist/hooks/use-frontend-tool.d.ts +21 -0
  18. package/dist/hooks/use-frontend-tool.d.ts.map +1 -0
  19. package/dist/index.cjs +2 -0
  20. package/dist/index.cjs.map +1 -0
  21. package/dist/index.d.cts +10 -0
  22. package/dist/index.d.mts +10 -0
  23. package/dist/index.d.ts +10 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.mjs +252 -0
  26. package/dist/index.mjs.map +1 -0
  27. package/dist/styles.css +2 -0
  28. package/dist/use-render-activity-message-BRL1Rpl-.cjs +85 -0
  29. package/dist/use-render-activity-message-BRL1Rpl-.cjs.map +1 -0
  30. package/dist/use-render-activity-message-CqtxiFSs.js +8927 -0
  31. package/dist/use-render-activity-message-CqtxiFSs.js.map +1 -0
  32. package/dist/v2/components/A2UIMessageRenderer.d.ts +9 -0
  33. package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -0
  34. package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts +16 -0
  35. package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -0
  36. package/dist/v2/components/CopilotKitInspector.vue.d.ts +7 -0
  37. package/dist/v2/components/CopilotKitInspector.vue.d.ts.map +1 -0
  38. package/dist/v2/components/InlineFeatureWarning.vue.d.ts +6 -0
  39. package/dist/v2/components/InlineFeatureWarning.vue.d.ts.map +1 -0
  40. package/dist/v2/components/LicenseWarningBanner.vue.d.ts +18 -0
  41. package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -0
  42. package/dist/v2/components/MCPAppsActivityRenderer.d.ts +88 -0
  43. package/dist/v2/components/MCPAppsActivityRenderer.d.ts.map +1 -0
  44. package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +154 -0
  45. package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -0
  46. package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +19 -0
  47. package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -0
  48. package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +16 -0
  49. package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -0
  50. package/dist/v2/components/a2ui/VueSurface.d.ts +62 -0
  51. package/dist/v2/components/a2ui/VueSurface.d.ts.map +1 -0
  52. package/dist/v2/components/a2ui/adapter.d.ts +38 -0
  53. package/dist/v2/components/a2ui/adapter.d.ts.map +1 -0
  54. package/dist/v2/components/a2ui/catalog.d.ts +29 -0
  55. package/dist/v2/components/a2ui/catalog.d.ts.map +1 -0
  56. package/dist/v2/components/a2ui/index.d.ts +5 -0
  57. package/dist/v2/components/a2ui/index.d.ts.map +1 -0
  58. package/dist/v2/components/a2ui/utils.d.ts +18 -0
  59. package/dist/v2/components/a2ui/utils.d.ts.map +1 -0
  60. package/dist/v2/components/a2ui.d.ts +12 -0
  61. package/dist/v2/components/a2ui.d.ts.map +1 -0
  62. package/dist/v2/components/chat/CopilotChat.vue.d.ts +50 -0
  63. package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -0
  64. package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts +164 -0
  65. package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -0
  66. package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts +12 -0
  67. package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -0
  68. package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts +7 -0
  69. package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts.map +1 -0
  70. package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts +12 -0
  71. package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts.map +1 -0
  72. package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +290 -0
  73. package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -0
  74. package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +72 -0
  75. package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -0
  76. package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts +65 -0
  77. package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -0
  78. package/dist/v2/components/chat/CopilotChatSuggestionPill.vue.d.ts +27 -0
  79. package/dist/v2/components/chat/CopilotChatSuggestionPill.vue.d.ts.map +1 -0
  80. package/dist/v2/components/chat/CopilotChatSuggestionView.vue.d.ts +26 -0
  81. package/dist/v2/components/chat/CopilotChatSuggestionView.vue.d.ts.map +1 -0
  82. package/dist/v2/components/chat/CopilotChatToggleButton.vue.d.ts +17 -0
  83. package/dist/v2/components/chat/CopilotChatToggleButton.vue.d.ts.map +1 -0
  84. package/dist/v2/components/chat/CopilotChatToggleButtonCloseIcon.d.ts +5 -0
  85. package/dist/v2/components/chat/CopilotChatToggleButtonCloseIcon.d.ts.map +1 -0
  86. package/dist/v2/components/chat/CopilotChatToggleButtonOpenIcon.d.ts +5 -0
  87. package/dist/v2/components/chat/CopilotChatToggleButtonOpenIcon.d.ts.map +1 -0
  88. package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +21 -0
  89. package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -0
  90. package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts +34 -0
  91. package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts.map +1 -0
  92. package/dist/v2/components/chat/CopilotChatView.vue.d.ts +106 -0
  93. package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -0
  94. package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts +15 -0
  95. package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -0
  96. package/dist/v2/components/chat/CopilotModalHeaderCloseButton.d.ts +5 -0
  97. package/dist/v2/components/chat/CopilotModalHeaderCloseButton.d.ts.map +1 -0
  98. package/dist/v2/components/chat/CopilotModalHeaderTitle.d.ts +5 -0
  99. package/dist/v2/components/chat/CopilotModalHeaderTitle.d.ts.map +1 -0
  100. package/dist/v2/components/chat/CopilotPopup.vue.d.ts +50 -0
  101. package/dist/v2/components/chat/CopilotPopup.vue.d.ts.map +1 -0
  102. package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +55 -0
  103. package/dist/v2/components/chat/CopilotPopupView.vue.d.ts.map +1 -0
  104. package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +55 -0
  105. package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -0
  106. package/dist/v2/components/chat/CopilotPopupWelcomeScreen.vue.d.ts +28 -0
  107. package/dist/v2/components/chat/CopilotPopupWelcomeScreen.vue.d.ts.map +1 -0
  108. package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +48 -0
  109. package/dist/v2/components/chat/CopilotSidebar.vue.d.ts.map +1 -0
  110. package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +62 -0
  111. package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts.map +1 -0
  112. package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +53 -0
  113. package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -0
  114. package/dist/v2/components/chat/CopilotSidebarWelcomeScreen.vue.d.ts +28 -0
  115. package/dist/v2/components/chat/CopilotSidebarWelcomeScreen.vue.d.ts.map +1 -0
  116. package/dist/v2/components/chat/audioRecorder.d.ts +11 -0
  117. package/dist/v2/components/chat/audioRecorder.d.ts.map +1 -0
  118. package/dist/v2/components/chat/index.d.ts +682 -0
  119. package/dist/v2/components/chat/index.d.ts.map +1 -0
  120. package/dist/v2/components/chat/last-user-message-context.d.ts +29 -0
  121. package/dist/v2/components/chat/last-user-message-context.d.ts.map +1 -0
  122. package/dist/v2/components/chat/normalize-auto-scroll.d.ts +3 -0
  123. package/dist/v2/components/chat/normalize-auto-scroll.d.ts.map +1 -0
  124. package/dist/v2/components/chat/types.d.ts +380 -0
  125. package/dist/v2/components/chat/types.d.ts.map +1 -0
  126. package/dist/v2/components/icons/index.d.ts +2 -0
  127. package/dist/v2/components/icons/index.d.ts.map +1 -0
  128. package/dist/v2/components/index.d.ts +8 -0
  129. package/dist/v2/components/index.d.ts.map +1 -0
  130. package/dist/v2/hooks/index.d.ts +24 -0
  131. package/dist/v2/hooks/index.d.ts.map +1 -0
  132. package/dist/v2/hooks/use-agent-context.d.ts +24 -0
  133. package/dist/v2/hooks/use-agent-context.d.ts.map +1 -0
  134. package/dist/v2/hooks/use-agent.d.ts +53 -0
  135. package/dist/v2/hooks/use-agent.d.ts.map +1 -0
  136. package/dist/v2/hooks/use-attachments.d.ts +21 -0
  137. package/dist/v2/hooks/use-attachments.d.ts.map +1 -0
  138. package/dist/v2/hooks/use-capabilities.d.ts +16 -0
  139. package/dist/v2/hooks/use-capabilities.d.ts.map +1 -0
  140. package/dist/v2/hooks/use-component.d.ts +13 -0
  141. package/dist/v2/hooks/use-component.d.ts.map +1 -0
  142. package/dist/v2/hooks/use-configure-suggestions.d.ts +24 -0
  143. package/dist/v2/hooks/use-configure-suggestions.d.ts.map +1 -0
  144. package/dist/v2/hooks/use-default-render-tool.d.ts +14 -0
  145. package/dist/v2/hooks/use-default-render-tool.d.ts.map +1 -0
  146. package/dist/v2/hooks/use-frontend-tool.d.ts +19 -0
  147. package/dist/v2/hooks/use-frontend-tool.d.ts.map +1 -0
  148. package/dist/v2/hooks/use-human-in-the-loop.d.ts +19 -0
  149. package/dist/v2/hooks/use-human-in-the-loop.d.ts.map +1 -0
  150. package/dist/v2/hooks/use-interrupt.d.ts +36 -0
  151. package/dist/v2/hooks/use-interrupt.d.ts.map +1 -0
  152. package/dist/v2/hooks/use-katex-styles.d.ts +22 -0
  153. package/dist/v2/hooks/use-katex-styles.d.ts.map +1 -0
  154. package/dist/v2/hooks/use-keyboard-height.d.ts +33 -0
  155. package/dist/v2/hooks/use-keyboard-height.d.ts.map +1 -0
  156. package/dist/v2/hooks/use-pin-to-send.d.ts +28 -0
  157. package/dist/v2/hooks/use-pin-to-send.d.ts.map +1 -0
  158. package/dist/v2/hooks/use-render-activity-message.d.ts +21 -0
  159. package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -0
  160. package/dist/v2/hooks/use-render-custom-messages.d.ts +27 -0
  161. package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -0
  162. package/dist/v2/hooks/use-render-tool.d.ts +36 -0
  163. package/dist/v2/hooks/use-render-tool.d.ts.map +1 -0
  164. package/dist/v2/hooks/use-suggestions.d.ts +26 -0
  165. package/dist/v2/hooks/use-suggestions.d.ts.map +1 -0
  166. package/dist/v2/hooks/use-threads.d.ts +42 -0
  167. package/dist/v2/hooks/use-threads.d.ts.map +1 -0
  168. package/dist/v2/index.cjs +2 -0
  169. package/dist/v2/index.cjs.map +1 -0
  170. package/dist/v2/index.d.cts +9 -0
  171. package/dist/v2/index.d.mts +9 -0
  172. package/dist/v2/index.d.ts +9 -0
  173. package/dist/v2/index.d.ts.map +1 -0
  174. package/dist/v2/index.mjs +75 -0
  175. package/dist/v2/index.mjs.map +1 -0
  176. package/dist/v2/lib/processPartialHtml.d.ts +3 -0
  177. package/dist/v2/lib/processPartialHtml.d.ts.map +1 -0
  178. package/dist/v2/lib/shallow-stable.d.ts +7 -0
  179. package/dist/v2/lib/shallow-stable.d.ts.map +1 -0
  180. package/dist/v2/lib/transcription-client.d.ts +19 -0
  181. package/dist/v2/lib/transcription-client.d.ts.map +1 -0
  182. package/dist/v2/lib/vue-core.d.ts +47 -0
  183. package/dist/v2/lib/vue-core.d.ts.map +1 -0
  184. package/dist/v2/providers/CopilotChatConfigurationProvider.types.d.ts +15 -0
  185. package/dist/v2/providers/CopilotChatConfigurationProvider.types.d.ts.map +1 -0
  186. package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts +17 -0
  187. package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -0
  188. package/dist/v2/providers/CopilotKitProvider.types.d.ts +61 -0
  189. package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -0
  190. package/dist/v2/providers/CopilotKitProvider.vue.d.ts +37 -0
  191. package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -0
  192. package/dist/v2/providers/SandboxFunctionsContext.d.ts +4 -0
  193. package/dist/v2/providers/SandboxFunctionsContext.d.ts.map +1 -0
  194. package/dist/v2/providers/index.d.ts +13 -0
  195. package/dist/v2/providers/index.d.ts.map +1 -0
  196. package/dist/v2/providers/keys.d.ts +17 -0
  197. package/dist/v2/providers/keys.d.ts.map +1 -0
  198. package/dist/v2/providers/license-context.d.ts +7 -0
  199. package/dist/v2/providers/license-context.d.ts.map +1 -0
  200. package/dist/v2/providers/types.d.ts +38 -0
  201. package/dist/v2/providers/types.d.ts.map +1 -0
  202. package/dist/v2/providers/useCopilotChatConfiguration.d.ts +4 -0
  203. package/dist/v2/providers/useCopilotChatConfiguration.d.ts.map +1 -0
  204. package/dist/v2/providers/useCopilotKit.d.ts +2 -0
  205. package/dist/v2/providers/useCopilotKit.d.ts.map +1 -0
  206. package/dist/v2/providers/useLicenseContext.d.ts +14 -0
  207. package/dist/v2/providers/useLicenseContext.d.ts.map +1 -0
  208. package/dist/v2/types/a2ui.d.ts +5 -0
  209. package/dist/v2/types/a2ui.d.ts.map +1 -0
  210. package/dist/v2/types/defineToolCallRenderer.d.ts +15 -0
  211. package/dist/v2/types/defineToolCallRenderer.d.ts.map +1 -0
  212. package/dist/v2/types/frontend-tool.d.ts +6 -0
  213. package/dist/v2/types/frontend-tool.d.ts.map +1 -0
  214. package/dist/v2/types/human-in-the-loop.d.ts +29 -0
  215. package/dist/v2/types/human-in-the-loop.d.ts.map +1 -0
  216. package/dist/v2/types/index.d.ts +10 -0
  217. package/dist/v2/types/index.d.ts.map +1 -0
  218. package/dist/v2/types/interrupt.d.ts +14 -0
  219. package/dist/v2/types/interrupt.d.ts.map +1 -0
  220. package/dist/v2/types/sandbox-function.d.ts +8 -0
  221. package/dist/v2/types/sandbox-function.d.ts.map +1 -0
  222. package/dist/v2/types/vue-activity-message-renderer.d.ts +18 -0
  223. package/dist/v2/types/vue-activity-message-renderer.d.ts.map +1 -0
  224. package/dist/v2/types/vue-custom-message-renderer.d.ts +19 -0
  225. package/dist/v2/types/vue-custom-message-renderer.d.ts.map +1 -0
  226. package/dist/v2/types/vue-tool-call-renderer.d.ts +37 -0
  227. package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -0
  228. package/env.d.ts +7 -0
  229. package/eslint.config.mjs +42 -0
  230. package/package.json +130 -0
  231. package/scripts/scope-preflight.mjs +100 -0
  232. package/src/components/copilot-provider/CopilotKit.vue +18 -0
  233. package/src/components/copilot-provider/index.ts +2 -0
  234. package/src/components/copilot-provider/types.ts +24 -0
  235. package/src/hooks/index.ts +9 -0
  236. package/src/hooks/use-copilot-action.ts +168 -0
  237. package/src/hooks/use-copilot-readable.ts +75 -0
  238. package/src/hooks/use-frontend-tool.ts +76 -0
  239. package/src/index.ts +12 -0
  240. package/src/styles/globals.css +314 -0
  241. package/src/v2/__tests__/exports.test.ts +35 -0
  242. package/src/v2/__tests__/mocks/web-inspector.ts +5 -0
  243. package/src/v2/__tests__/setup.ts +141 -0
  244. package/src/v2/__tests__/utils/agents.ts +391 -0
  245. package/src/v2/__tests__/utils/mount.ts +83 -0
  246. package/src/v2/__tests__/utils/test-helpers.ts +712 -0
  247. package/src/v2/components/A2UIMessageRenderer.ts +125 -0
  248. package/src/v2/components/A2UISurfaceActivityRenderer.vue +186 -0
  249. package/src/v2/components/CopilotKitInspector.vue +42 -0
  250. package/src/v2/components/InlineFeatureWarning.vue +35 -0
  251. package/src/v2/components/LicenseWarningBanner.vue +196 -0
  252. package/src/v2/components/MCPAppsActivityRenderer.ts +778 -0
  253. package/src/v2/components/OpenGenerativeUIRenderer.ts +550 -0
  254. package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +271 -0
  255. package/src/v2/components/__tests__/CopilotKitInspector.test.ts +57 -0
  256. package/src/v2/components/__tests__/MCPAppsActivityRenderer.e2e.test.ts +851 -0
  257. package/src/v2/components/__tests__/MCPAppsActivityRenderer.test.ts +237 -0
  258. package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +516 -0
  259. package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +295 -0
  260. package/src/v2/components/a2ui/A2UICatalogContext.ts +190 -0
  261. package/src/v2/components/a2ui/VueSurface.ts +144 -0
  262. package/src/v2/components/a2ui/adapter.ts +156 -0
  263. package/src/v2/components/a2ui/catalog.ts +858 -0
  264. package/src/v2/components/a2ui/index.ts +7 -0
  265. package/src/v2/components/a2ui/utils.ts +67 -0
  266. package/src/v2/components/a2ui.ts +30 -0
  267. package/src/v2/components/chat/CopilotChat.vue +777 -0
  268. package/src/v2/components/chat/CopilotChatAssistantMessage.vue +891 -0
  269. package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +411 -0
  270. package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +87 -0
  271. package/src/v2/components/chat/CopilotChatAudioRecorder.vue +269 -0
  272. package/src/v2/components/chat/CopilotChatInput.vue +1271 -0
  273. package/src/v2/components/chat/CopilotChatMessageView.vue +476 -0
  274. package/src/v2/components/chat/CopilotChatReasoningMessage.vue +247 -0
  275. package/src/v2/components/chat/CopilotChatSuggestionPill.vue +56 -0
  276. package/src/v2/components/chat/CopilotChatSuggestionView.vue +93 -0
  277. package/src/v2/components/chat/CopilotChatToggleButton.vue +145 -0
  278. package/src/v2/components/chat/CopilotChatToggleButtonCloseIcon.ts +17 -0
  279. package/src/v2/components/chat/CopilotChatToggleButtonOpenIcon.ts +18 -0
  280. package/src/v2/components/chat/CopilotChatToolCallsView.vue +161 -0
  281. package/src/v2/components/chat/CopilotChatUserMessage.vue +322 -0
  282. package/src/v2/components/chat/CopilotChatView.vue +740 -0
  283. package/src/v2/components/chat/CopilotModalHeader.vue +73 -0
  284. package/src/v2/components/chat/CopilotModalHeaderCloseButton.ts +38 -0
  285. package/src/v2/components/chat/CopilotModalHeaderTitle.ts +22 -0
  286. package/src/v2/components/chat/CopilotPopup.vue +182 -0
  287. package/src/v2/components/chat/CopilotPopupView.vue +168 -0
  288. package/src/v2/components/chat/CopilotPopupViewInternal.vue +453 -0
  289. package/src/v2/components/chat/CopilotPopupWelcomeScreen.vue +140 -0
  290. package/src/v2/components/chat/CopilotSidebar.vue +178 -0
  291. package/src/v2/components/chat/CopilotSidebarView.vue +172 -0
  292. package/src/v2/components/chat/CopilotSidebarViewInternal.vue +366 -0
  293. package/src/v2/components/chat/CopilotSidebarWelcomeScreen.vue +142 -0
  294. package/src/v2/components/chat/__tests__/CopilotChat.attachments.test.ts +237 -0
  295. package/src/v2/components/chat/__tests__/CopilotChat.e2e.test.ts +1240 -0
  296. package/src/v2/components/chat/__tests__/CopilotChat.licenseWarning.test.ts +138 -0
  297. package/src/v2/components/chat/__tests__/CopilotChat.onError.test.ts +85 -0
  298. package/src/v2/components/chat/__tests__/CopilotChat.slots.e2e.test.ts +141 -0
  299. package/src/v2/components/chat/__tests__/CopilotChat.test.ts +652 -0
  300. package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.ts +683 -0
  301. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.slots.e2e.test.ts +768 -0
  302. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.test.ts +1108 -0
  303. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.thumbs.test.ts +87 -0
  304. package/src/v2/components/chat/__tests__/CopilotChatAttachmentQueue.test.ts +277 -0
  305. package/src/v2/components/chat/__tests__/CopilotChatAttachmentRenderer.test.ts +124 -0
  306. package/src/v2/components/chat/__tests__/CopilotChatCopyButton.clipboard.test.ts +230 -0
  307. package/src/v2/components/chat/__tests__/CopilotChatInput.bottomAnchored.test.ts +83 -0
  308. package/src/v2/components/chat/__tests__/CopilotChatInput.slots.e2e.test.ts +1139 -0
  309. package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +1051 -0
  310. package/src/v2/components/chat/__tests__/CopilotChatMessageView.slots.e2e.test.ts +141 -0
  311. package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.ts +494 -0
  312. package/src/v2/components/chat/__tests__/CopilotChatPropsRerender.e2e.test.ts +181 -0
  313. package/src/v2/components/chat/__tests__/CopilotChatReasoningMessage.test.ts +73 -0
  314. package/src/v2/components/chat/__tests__/CopilotChatSuggestionPill.test.ts +73 -0
  315. package/src/v2/components/chat/__tests__/CopilotChatSuggestionView.slots.e2e.test.ts +674 -0
  316. package/src/v2/components/chat/__tests__/CopilotChatSuggestionView.test.ts +91 -0
  317. package/src/v2/components/chat/__tests__/CopilotChatToggleButton.test.ts +93 -0
  318. package/src/v2/components/chat/__tests__/CopilotChatToolCallsView.test.ts +382 -0
  319. package/src/v2/components/chat/__tests__/CopilotChatToolRendering.e2e.test.ts +1019 -0
  320. package/src/v2/components/chat/__tests__/CopilotChatToolRerenders.e2e.test.ts +516 -0
  321. package/src/v2/components/chat/__tests__/CopilotChatUserMessage.slots.e2e.test.ts +701 -0
  322. package/src/v2/components/chat/__tests__/CopilotChatUserMessage.test.ts +337 -0
  323. package/src/v2/components/chat/__tests__/CopilotChatView.connectingGate.test.ts +135 -0
  324. package/src/v2/components/chat/__tests__/CopilotChatView.inputOverlay.test.ts +278 -0
  325. package/src/v2/components/chat/__tests__/CopilotChatView.onClick.e2e.test.ts +1082 -0
  326. package/src/v2/components/chat/__tests__/CopilotChatView.pinToSend.test.ts +166 -0
  327. package/src/v2/components/chat/__tests__/CopilotChatView.slots.e2e.test.ts +1145 -0
  328. package/src/v2/components/chat/__tests__/CopilotChatView.test.ts +374 -0
  329. package/src/v2/components/chat/__tests__/CopilotModalHeader.slots.e2e.test.ts +636 -0
  330. package/src/v2/components/chat/__tests__/CopilotModalHeader.test.ts +112 -0
  331. package/src/v2/components/chat/__tests__/CopilotPopup.test.ts +58 -0
  332. package/src/v2/components/chat/__tests__/CopilotPopupView.slots.e2e.test.ts +725 -0
  333. package/src/v2/components/chat/__tests__/CopilotPopupView.test.ts +112 -0
  334. package/src/v2/components/chat/__tests__/CopilotSidebar.test.ts +58 -0
  335. package/src/v2/components/chat/__tests__/CopilotSidebarView.slots.e2e.test.ts +603 -0
  336. package/src/v2/components/chat/__tests__/CopilotSidebarView.test.ts +214 -0
  337. package/src/v2/components/chat/__tests__/MCPAppsUiMessage.e2e.test.ts +394 -0
  338. package/src/v2/components/chat/__tests__/copilot-chat-throttle.test.ts +82 -0
  339. package/src/v2/components/chat/__tests__/normalize-auto-scroll.test.ts +39 -0
  340. package/src/v2/components/chat/audioRecorder.ts +15 -0
  341. package/src/v2/components/chat/index.ts +52 -0
  342. package/src/v2/components/chat/last-user-message-context.ts +39 -0
  343. package/src/v2/components/chat/normalize-auto-scroll.ts +17 -0
  344. package/src/v2/components/chat/types.ts +481 -0
  345. package/src/v2/components/icons/__tests__/icons.test.ts +86 -0
  346. package/src/v2/components/icons/index.ts +22 -0
  347. package/src/v2/components/index.ts +7 -0
  348. package/src/v2/hooks/__tests__/standard-schema-types.test.ts +149 -0
  349. package/src/v2/hooks/__tests__/standard-schema.test.ts +315 -0
  350. package/src/v2/hooks/__tests__/use-agent-context-timing.e2e.test.ts +144 -0
  351. package/src/v2/hooks/__tests__/use-agent-context.test.ts +271 -0
  352. package/src/v2/hooks/__tests__/use-agent-error-state.test.ts +64 -0
  353. package/src/v2/hooks/__tests__/use-agent-stability.test.ts +268 -0
  354. package/src/v2/hooks/__tests__/use-agent-thread-isolation.test.ts +433 -0
  355. package/src/v2/hooks/__tests__/use-agent-throttle.test.ts +747 -0
  356. package/src/v2/hooks/__tests__/use-agent.e2e.test.ts +187 -0
  357. package/src/v2/hooks/__tests__/use-agent.test.ts +126 -0
  358. package/src/v2/hooks/__tests__/use-attachments.test.ts +181 -0
  359. package/src/v2/hooks/__tests__/use-component.test.ts +145 -0
  360. package/src/v2/hooks/__tests__/use-configure-suggestions.e2e.test.ts +527 -0
  361. package/src/v2/hooks/__tests__/use-configure-suggestions.test.ts +399 -0
  362. package/src/v2/hooks/__tests__/use-default-render-tool.test.ts +214 -0
  363. package/src/v2/hooks/__tests__/use-frontend-tool-available.test.ts +220 -0
  364. package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +2320 -0
  365. package/src/v2/hooks/__tests__/use-frontend-tool.test.ts +648 -0
  366. package/src/v2/hooks/__tests__/use-human-in-the-loop.e2e.test.ts +1379 -0
  367. package/src/v2/hooks/__tests__/use-human-in-the-loop.test.ts +282 -0
  368. package/src/v2/hooks/__tests__/use-interrupt.test.ts +345 -0
  369. package/src/v2/hooks/__tests__/use-katex-styles.test.ts +69 -0
  370. package/src/v2/hooks/__tests__/use-keyboard-height.test.ts +199 -0
  371. package/src/v2/hooks/__tests__/use-pin-to-send.test.ts +363 -0
  372. package/src/v2/hooks/__tests__/use-render-tool.test.ts +329 -0
  373. package/src/v2/hooks/__tests__/use-suggestions.e2e.test.ts +397 -0
  374. package/src/v2/hooks/__tests__/use-suggestions.test.ts +198 -0
  375. package/src/v2/hooks/__tests__/use-threads.test.ts +1041 -0
  376. package/src/v2/hooks/__tests__/zod-regression.test.ts +339 -0
  377. package/src/v2/hooks/index.ts +29 -0
  378. package/src/v2/hooks/use-agent-context.ts +55 -0
  379. package/src/v2/hooks/use-agent.ts +345 -0
  380. package/src/v2/hooks/use-attachments.ts +261 -0
  381. package/src/v2/hooks/use-capabilities.ts +30 -0
  382. package/src/v2/hooks/use-component.ts +46 -0
  383. package/src/v2/hooks/use-configure-suggestions.ts +252 -0
  384. package/src/v2/hooks/use-default-render-tool.ts +130 -0
  385. package/src/v2/hooks/use-frontend-tool.ts +68 -0
  386. package/src/v2/hooks/use-human-in-the-loop.ts +90 -0
  387. package/src/v2/hooks/use-interrupt.ts +257 -0
  388. package/src/v2/hooks/use-katex-styles.ts +44 -0
  389. package/src/v2/hooks/use-keyboard-height.ts +87 -0
  390. package/src/v2/hooks/use-pin-to-send.ts +160 -0
  391. package/src/v2/hooks/use-render-activity-message.ts +92 -0
  392. package/src/v2/hooks/use-render-custom-messages.ts +129 -0
  393. package/src/v2/hooks/use-render-tool.ts +128 -0
  394. package/src/v2/hooks/use-suggestions.ts +98 -0
  395. package/src/v2/hooks/use-threads.ts +208 -0
  396. package/src/v2/index.ts +11 -0
  397. package/src/v2/lib/__tests__/processPartialHtml.test.ts +84 -0
  398. package/src/v2/lib/__tests__/transcription-client.test.ts +65 -0
  399. package/src/v2/lib/processPartialHtml.ts +21 -0
  400. package/src/v2/lib/shallow-stable.ts +54 -0
  401. package/src/v2/lib/transcription-client.ts +151 -0
  402. package/src/v2/lib/vue-core.ts +161 -0
  403. package/src/v2/providers/CopilotChatConfigurationProvider.types.ts +15 -0
  404. package/src/v2/providers/CopilotChatConfigurationProvider.vue +95 -0
  405. package/src/v2/providers/CopilotKitProvider.types.ts +66 -0
  406. package/src/v2/providers/CopilotKitProvider.vue +653 -0
  407. package/src/v2/providers/SandboxFunctionsContext.ts +11 -0
  408. package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.test.ts +309 -0
  409. package/src/v2/providers/__tests__/CopilotKitProvider.debug.test.ts +295 -0
  410. package/src/v2/providers/__tests__/CopilotKitProvider.license.test.ts +110 -0
  411. package/src/v2/providers/__tests__/CopilotKitProvider.onError.test.ts +67 -0
  412. package/src/v2/providers/__tests__/CopilotKitProvider.renderCustomMessages.e2e.test.ts +901 -0
  413. package/src/v2/providers/__tests__/CopilotKitProvider.sandboxFunctions.test.ts +141 -0
  414. package/src/v2/providers/__tests__/CopilotKitProvider.stability.test.ts +871 -0
  415. package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +603 -0
  416. package/src/v2/providers/__tests__/CopilotKitProvider.wildcard.test.ts +104 -0
  417. package/src/v2/providers/index.ts +21 -0
  418. package/src/v2/providers/keys.ts +25 -0
  419. package/src/v2/providers/license-context.ts +16 -0
  420. package/src/v2/providers/types.ts +40 -0
  421. package/src/v2/providers/useCopilotChatConfiguration.ts +11 -0
  422. package/src/v2/providers/useCopilotKit.ts +11 -0
  423. package/src/v2/providers/useLicenseContext.ts +21 -0
  424. package/src/v2/types/__tests__/defineToolCallRenderer.test.ts +157 -0
  425. package/src/v2/types/a2ui.ts +5 -0
  426. package/src/v2/types/defineToolCallRenderer.ts +32 -0
  427. package/src/v2/types/frontend-tool.ts +8 -0
  428. package/src/v2/types/human-in-the-loop.ts +38 -0
  429. package/src/v2/types/index.ts +9 -0
  430. package/src/v2/types/interrupt.ts +15 -0
  431. package/src/v2/types/sandbox-function.ts +8 -0
  432. package/src/v2/types/vue-activity-message-renderer.ts +22 -0
  433. package/src/v2/types/vue-custom-message-renderer.ts +24 -0
  434. package/src/v2/types/vue-tool-call-renderer.ts +44 -0
  435. package/tsconfig.json +27 -0
  436. package/vite.config.ts +49 -0
  437. package/vitest.config.ts +23 -0
@@ -0,0 +1,1019 @@
1
+ import {
2
+ render,
3
+ screen,
4
+ fireEvent,
5
+ waitFor,
6
+ cleanup,
7
+ } from "@testing-library/vue";
8
+ import { computed, defineComponent, nextTick } from "vue";
9
+ import type { PropType } from "vue";
10
+ import { afterEach, describe, expect, it } from "vitest";
11
+ import { z } from "zod";
12
+ import type { AssistantMessage, Message, ToolMessage } from "@ag-ui/core";
13
+ import { ToolCallStatus } from "@copilotkit/core";
14
+ import { AbstractAgent, EventType } from "@ag-ui/client";
15
+ import type { BaseEvent, RunAgentInput } from "@ag-ui/client";
16
+ import { Observable, Subject } from "rxjs";
17
+ import CopilotKitProvider from "../../../providers/CopilotKitProvider.vue";
18
+ import CopilotChatConfigurationProvider from "../../../providers/CopilotChatConfigurationProvider.vue";
19
+ import CopilotChat from "../CopilotChat.vue";
20
+ import CopilotChatToolCallsView from "../CopilotChatToolCallsView.vue";
21
+ import { useFrontendTool } from "../../../hooks/use-frontend-tool";
22
+ import type { VueFrontendTool } from "../../../types";
23
+ import type { VueToolCallRendererRenderProps } from "../../../types/vue-tool-call-renderer";
24
+
25
+ afterEach(() => {
26
+ cleanup();
27
+ document.body.innerHTML = "";
28
+ });
29
+
30
+ async function submitMessage(value: string) {
31
+ const input = await screen.findByRole("textbox");
32
+ await fireEvent.update(input, value);
33
+ await fireEvent.keyDown(input, { key: "Enter", code: "Enter" });
34
+ }
35
+
36
+ class MockStreamingAgent extends AbstractAgent {
37
+ clone(): MockStreamingAgent {
38
+ return new MockStreamingAgent();
39
+ }
40
+
41
+ run(_input: RunAgentInput): Observable<BaseEvent> {
42
+ return new Observable<BaseEvent>((observer) => {
43
+ const messageId = `m_${Date.now()}`;
44
+ const toolCallId = `tc_${Date.now()}`;
45
+
46
+ observer.next({ type: EventType.RUN_STARTED } as BaseEvent);
47
+ observer.next({
48
+ type: EventType.TEXT_MESSAGE_CHUNK,
49
+ messageId,
50
+ delta: "I will check the weather.",
51
+ } as BaseEvent);
52
+ observer.next({
53
+ type: EventType.TOOL_CALL_CHUNK,
54
+ toolCallId,
55
+ toolCallName: "getWeather",
56
+ parentMessageId: messageId,
57
+ delta: '{"location":"Paris","unit":"c',
58
+ } as BaseEvent);
59
+ observer.next({
60
+ type: EventType.TOOL_CALL_CHUNK,
61
+ toolCallId,
62
+ parentMessageId: messageId,
63
+ delta: 'elsius"}',
64
+ } as BaseEvent);
65
+ observer.next({
66
+ type: EventType.TOOL_CALL_RESULT,
67
+ toolCallId,
68
+ messageId: `${messageId}_result`,
69
+ content: JSON.stringify({ temperature: 21, unit: "celsius" }),
70
+ } as BaseEvent);
71
+ observer.next({ type: EventType.RUN_FINISHED } as BaseEvent);
72
+ observer.complete();
73
+ });
74
+ }
75
+ }
76
+
77
+ class MockStepwiseAgent extends AbstractAgent {
78
+ private readonly subject = new Subject<BaseEvent>();
79
+ private bufferedEvents: BaseEvent[] = [];
80
+ private bufferedComplete = false;
81
+
82
+ async emit(event: BaseEvent): Promise<void> {
83
+ if (event.type === EventType.RUN_STARTED) {
84
+ this.isRunning = true;
85
+ } else if (
86
+ event.type === EventType.RUN_FINISHED ||
87
+ event.type === EventType.RUN_ERROR
88
+ ) {
89
+ this.isRunning = false;
90
+ }
91
+ if (this.subject.observers.length === 0) {
92
+ this.bufferedEvents.push(event);
93
+ } else {
94
+ this.subject.next(event);
95
+ }
96
+ await flushVueUpdates();
97
+ }
98
+
99
+ async complete(): Promise<void> {
100
+ this.isRunning = false;
101
+ if (this.subject.observers.length === 0) {
102
+ this.bufferedComplete = true;
103
+ } else {
104
+ this.subject.complete();
105
+ }
106
+ await flushVueUpdates();
107
+ }
108
+
109
+ clone(): MockStepwiseAgent {
110
+ return Object.assign(new MockStepwiseAgent(), this);
111
+ }
112
+
113
+ run(_input: RunAgentInput): Observable<BaseEvent> {
114
+ return new Observable<BaseEvent>((observer) => {
115
+ if (this.bufferedEvents.length > 0) {
116
+ for (const event of this.bufferedEvents) {
117
+ observer.next(event);
118
+ }
119
+ this.bufferedEvents = [];
120
+ }
121
+
122
+ if (this.bufferedComplete) {
123
+ this.bufferedComplete = false;
124
+ observer.complete();
125
+ return;
126
+ }
127
+
128
+ const subscription = this.subject.subscribe(observer);
129
+ return () => subscription.unsubscribe();
130
+ });
131
+ }
132
+ }
133
+
134
+ async function flushVueUpdates(): Promise<void> {
135
+ await nextTick();
136
+ await new Promise((resolve) => setTimeout(resolve, 0));
137
+ }
138
+
139
+ const WeatherRenderer = defineComponent({
140
+ props: {
141
+ name: { type: String, required: true },
142
+ args: { type: Object as PropType<Record<string, unknown>>, required: true },
143
+ result: { type: null as unknown as PropType<unknown>, required: false },
144
+ },
145
+ setup(
146
+ props: VueToolCallRendererRenderProps<{ location: string; unit: string }>,
147
+ ) {
148
+ const text = computed(
149
+ () =>
150
+ `Tool: ${props.name} | args: ${String(props.args.location ?? "")}-${String(props.args.unit ?? "")} | result: ${String(props.result ?? "")}`,
151
+ );
152
+ return { text };
153
+ },
154
+ template: `<div data-testid="weather-result">{{ text }}</div>`,
155
+ });
156
+
157
+ const StatusRenderer = defineComponent({
158
+ props: {
159
+ status: { type: String, required: true },
160
+ args: { type: Object as PropType<Record<string, unknown>>, required: true },
161
+ result: { type: null as unknown as PropType<unknown>, required: false },
162
+ },
163
+ setup(props: VueToolCallRendererRenderProps<{ city?: string }>) {
164
+ const text = computed(() => {
165
+ if (props.status === ToolCallStatus.InProgress) {
166
+ return `INPROGRESS ${String(props.args.city ?? "")}`;
167
+ }
168
+ if (props.status === ToolCallStatus.Executing) {
169
+ return `EXECUTING ${String(props.args.city ?? "")}`;
170
+ }
171
+ return `COMPLETE ${String(props.args.city ?? "")} ${String(props.result ?? "")}`;
172
+ });
173
+ return { text };
174
+ },
175
+ template: `<div data-testid="status">{{ text }}</div>`,
176
+ });
177
+
178
+ const ToolStatusRenderer = defineComponent({
179
+ props: {
180
+ name: { type: String, required: true },
181
+ status: { type: String, required: true },
182
+ args: { type: Object as PropType<Record<string, unknown>>, required: true },
183
+ result: { type: null as unknown as PropType<unknown>, required: false },
184
+ },
185
+ setup(
186
+ props: VueToolCallRendererRenderProps<{ location: string; unit: string }>,
187
+ ) {
188
+ const text = computed(() => {
189
+ const label =
190
+ props.status === ToolCallStatus.InProgress ? "INPROGRESS" : "COMPLETE";
191
+ return `${props.name} ${label} ${String(props.args.location ?? "")} - ${String(props.args.unit ?? "")} ${String(props.result ?? "")}`;
192
+ });
193
+ return { text };
194
+ },
195
+ template: `<div data-testid="tool-status">{{ text }}</div>`,
196
+ });
197
+
198
+ const SlowToolStatusRenderer = defineComponent({
199
+ props: {
200
+ name: { type: String, required: true },
201
+ status: { type: String, required: true },
202
+ args: { type: Object as PropType<Record<string, unknown>>, required: true },
203
+ result: { type: null as unknown as PropType<unknown>, required: false },
204
+ },
205
+ setup(props: VueToolCallRendererRenderProps<{ value: string }>) {
206
+ const text = computed(
207
+ () =>
208
+ `Tool: ${props.name} | Status: ${props.status} | Value: ${String(props.args.value ?? "")} | Result: ${props.result ? "Complete" : "Pending"}`,
209
+ );
210
+ return { text };
211
+ },
212
+ template: `<div data-testid="slow-tool-status">{{ text }}</div>`,
213
+ });
214
+
215
+ const Tool1Renderer = defineComponent({
216
+ props: {
217
+ status: { type: String, required: true },
218
+ args: { type: Object as PropType<Record<string, unknown>>, required: true },
219
+ result: { type: null as unknown as PropType<unknown>, required: false },
220
+ },
221
+ setup(props: VueToolCallRendererRenderProps<{ id: string }>) {
222
+ const testId = computed(() => `tool1-${String(props.args.id ?? "")}`);
223
+ const text = computed(
224
+ () =>
225
+ `Tool1[${String(props.args.id ?? "")}]: ${props.status} - ${props.result ? JSON.stringify(props.result) : "waiting"}`,
226
+ );
227
+ return { testId, text };
228
+ },
229
+ template: `<div :data-testid="testId">{{ text }}</div>`,
230
+ });
231
+
232
+ const Tool2Renderer = defineComponent({
233
+ props: {
234
+ status: { type: String, required: true },
235
+ args: { type: Object as PropType<Record<string, unknown>>, required: true },
236
+ result: { type: null as unknown as PropType<unknown>, required: false },
237
+ },
238
+ setup(props: VueToolCallRendererRenderProps<{ id: string }>) {
239
+ const testId = computed(() => `tool2-${String(props.args.id ?? "")}`);
240
+ const text = computed(
241
+ () =>
242
+ `Tool2[${String(props.args.id ?? "")}]: ${props.status} - ${props.result ? JSON.stringify(props.result) : "waiting"}`,
243
+ );
244
+ return { testId, text };
245
+ },
246
+ template: `<div :data-testid="testId">{{ text }}</div>`,
247
+ });
248
+
249
+ const ComplexToolRenderer = defineComponent({
250
+ props: {
251
+ status: { type: String, required: true },
252
+ args: { type: Object as PropType<Record<string, unknown>>, required: true },
253
+ },
254
+ setup(
255
+ props: VueToolCallRendererRenderProps<{
256
+ name?: string;
257
+ age?: number;
258
+ city?: string;
259
+ }>,
260
+ ) {
261
+ const statusText = computed(() => `Status: ${props.status}`);
262
+ const nameText = computed(
263
+ () => `Name: ${String(props.args.name || "pending")}`,
264
+ );
265
+ const ageText = computed(() => {
266
+ const age = props.args.age;
267
+ return `Age: ${age !== undefined ? String(age) : "pending"}`;
268
+ });
269
+ const cityText = computed(
270
+ () => `City: ${String(props.args.city || "pending")}`,
271
+ );
272
+ return { statusText, nameText, ageText, cityText };
273
+ },
274
+ template: `
275
+ <div data-testid="complex-tool">
276
+ <div>{{ statusText }}</div>
277
+ <div>{{ nameText }}</div>
278
+ <div>{{ ageText }}</div>
279
+ <div>{{ cityText }}</div>
280
+ </div>
281
+ `,
282
+ });
283
+
284
+ const TestToolRenderer = defineComponent({
285
+ props: {
286
+ name: { type: String, required: true },
287
+ status: { type: String, required: true },
288
+ args: { type: Object as PropType<Record<string, unknown>>, required: true },
289
+ result: { type: null as unknown as PropType<unknown>, required: false },
290
+ },
291
+ template: `
292
+ <div data-testid="tool-render">
293
+ <span data-testid="status">{{ status }}</span>
294
+ <span data-testid="value">{{ args.value }}</span>
295
+ </div>
296
+ `,
297
+ });
298
+
299
+ function createAssistantMessage(
300
+ toolCalls: Array<{ id: string; name: string; argsJson: string }>,
301
+ ): AssistantMessage {
302
+ return {
303
+ id: "assistant-1",
304
+ role: "assistant",
305
+ content: "",
306
+ toolCalls: toolCalls.map((toolCall) => ({
307
+ id: toolCall.id,
308
+ type: "function",
309
+ function: {
310
+ name: toolCall.name,
311
+ arguments: toolCall.argsJson,
312
+ },
313
+ })),
314
+ } as AssistantMessage;
315
+ }
316
+
317
+ function renderChatHarness(args: {
318
+ agent: AbstractAgent;
319
+ frontendTools?: VueFrontendTool[];
320
+ registrar?: ReturnType<typeof defineComponent>;
321
+ }) {
322
+ const { agent, frontendTools = [], registrar } = args;
323
+ agent.agentId = "default";
324
+
325
+ const Host = defineComponent({
326
+ components: {
327
+ CopilotKitProvider,
328
+ CopilotChatConfigurationProvider,
329
+ CopilotChat,
330
+ },
331
+ setup() {
332
+ return {
333
+ agentId: "default",
334
+ agents: { default: agent },
335
+ frontendTools,
336
+ registrar,
337
+ };
338
+ },
339
+ template: `
340
+ <CopilotKitProvider
341
+ runtimeUrl="/api/copilotkit"
342
+ :agents__unsafe_dev_only="agents"
343
+ :frontendTools="frontendTools"
344
+ >
345
+ <CopilotChatConfigurationProvider thread-id="test-thread" :agent-id="agentId">
346
+ <component :is="registrar" v-if="registrar" />
347
+ <div style="height: 400px;">
348
+ <CopilotChat :welcome-screen="false" />
349
+ </div>
350
+ </CopilotChatConfigurationProvider>
351
+ </CopilotKitProvider>
352
+ `,
353
+ });
354
+
355
+ return render(Host);
356
+ }
357
+
358
+ function renderToolCallsHarness(args: {
359
+ message: AssistantMessage;
360
+ messages: Message[];
361
+ frontendTools: VueFrontendTool[];
362
+ }) {
363
+ const Host = defineComponent({
364
+ components: {
365
+ CopilotKitProvider,
366
+ CopilotChatConfigurationProvider,
367
+ CopilotChatToolCallsView,
368
+ },
369
+ setup() {
370
+ return {
371
+ message: args.message,
372
+ messages: args.messages,
373
+ frontendTools: args.frontendTools,
374
+ };
375
+ },
376
+ template: `
377
+ <CopilotKitProvider runtimeUrl="/api/copilotkit" :frontendTools="frontendTools">
378
+ <CopilotChatConfigurationProvider threadId="test-thread" agentId="default">
379
+ <CopilotChatToolCallsView :message="message" :messages="messages" />
380
+ </CopilotChatConfigurationProvider>
381
+ </CopilotKitProvider>
382
+ `,
383
+ });
384
+
385
+ return render(Host);
386
+ }
387
+
388
+ describe("CopilotChat tool rendering with mock agent", () => {
389
+ it("renders the tool component when the agent emits a tool call and result", async () => {
390
+ renderChatHarness({
391
+ agent: new MockStreamingAgent(),
392
+ frontendTools: [
393
+ {
394
+ name: "getWeather",
395
+ parameters: z.object({
396
+ location: z.string(),
397
+ unit: z.string(),
398
+ }),
399
+ render: WeatherRenderer,
400
+ },
401
+ ],
402
+ });
403
+
404
+ await submitMessage("What is the weather?");
405
+ const tool = await screen.findByTestId("weather-result");
406
+ await waitFor(() => {
407
+ expect(tool.textContent).toMatch(/temperature/);
408
+ expect(tool.textContent).toMatch(/celsius/);
409
+ });
410
+ });
411
+ });
412
+
413
+ describe("Tool render status narrowing", () => {
414
+ function renderStatusWithProvider({
415
+ withResult,
416
+ }: {
417
+ isRunning: boolean;
418
+ withResult: boolean;
419
+ }) {
420
+ const assistantMessage = createAssistantMessage([
421
+ { id: "tc_status_1", name: "getWeather", argsJson: '{"city":"Berlin"}' },
422
+ ]);
423
+
424
+ const messages: Message[] = [];
425
+ if (withResult) {
426
+ messages.push({
427
+ id: "t1",
428
+ role: "tool",
429
+ toolCallId: "tc_status_1",
430
+ content: "Sunny",
431
+ } as ToolMessage as any);
432
+ }
433
+
434
+ renderToolCallsHarness({
435
+ message: assistantMessage,
436
+ messages,
437
+ frontendTools: [
438
+ {
439
+ name: "getWeather",
440
+ parameters: z.object({ city: z.string().optional() }),
441
+ render: StatusRenderer,
442
+ },
443
+ ],
444
+ });
445
+ }
446
+
447
+ it("renders InProgress when running and no result", async () => {
448
+ renderStatusWithProvider({ isRunning: true, withResult: false });
449
+ const el = await screen.findByTestId("status");
450
+ expect(el.textContent).toMatch(/INPROGRESS/);
451
+ expect(el.textContent).toMatch(/Berlin/);
452
+ });
453
+
454
+ it("renders Complete with result when tool message exists", async () => {
455
+ renderStatusWithProvider({ isRunning: false, withResult: true });
456
+ const el = await screen.findByTestId("status");
457
+ expect(el.textContent).toMatch(/COMPLETE/);
458
+ expect(el.textContent).toMatch(/Berlin/);
459
+ expect(el.textContent).toMatch(/Sunny/);
460
+ });
461
+
462
+ it("renders InProgress when not running and no tool result", async () => {
463
+ renderStatusWithProvider({ isRunning: false, withResult: false });
464
+ const el = await screen.findByTestId("status");
465
+ expect(el.textContent).toMatch(/INPROGRESS/);
466
+ expect(el.textContent).toMatch(/Berlin/);
467
+ });
468
+ });
469
+
470
+ describe("Streaming in-progress without timers", () => {
471
+ it("shows InProgress for partial args and Complete after result", async () => {
472
+ const agent = new MockStepwiseAgent();
473
+ renderChatHarness({
474
+ agent,
475
+ frontendTools: [
476
+ {
477
+ name: "getWeather",
478
+ parameters: z.object({
479
+ location: z.string(),
480
+ unit: z.string(),
481
+ }),
482
+ render: ToolStatusRenderer,
483
+ },
484
+ ],
485
+ });
486
+
487
+ await submitMessage("Weather please");
488
+ await waitFor(() => {
489
+ expect(screen.getByText("Weather please")).toBeDefined();
490
+ });
491
+
492
+ const messageId = "m_step";
493
+ const toolCallId = "tc_step";
494
+
495
+ await agent.emit({
496
+ type: EventType.RUN_STARTED,
497
+ } as BaseEvent);
498
+ await agent.emit({
499
+ type: EventType.TEXT_MESSAGE_CHUNK,
500
+ messageId,
501
+ delta: "Checking weather",
502
+ } as BaseEvent);
503
+ await agent.emit({
504
+ type: EventType.TOOL_CALL_CHUNK,
505
+ toolCallId,
506
+ toolCallName: "getWeather",
507
+ parentMessageId: messageId,
508
+ delta: '{"location":"Paris"',
509
+ } as BaseEvent);
510
+
511
+ await waitFor(() => {
512
+ const el = screen.getByTestId("tool-status");
513
+ expect(el.textContent).toContain("getWeather INPROGRESS");
514
+ expect(el.textContent).toContain("Paris");
515
+ });
516
+
517
+ await agent.emit({
518
+ type: EventType.TOOL_CALL_CHUNK,
519
+ toolCallId,
520
+ parentMessageId: messageId,
521
+ delta: ',"unit":"celsius"}',
522
+ } as BaseEvent);
523
+
524
+ await waitFor(() => {
525
+ const el = screen.getByTestId("tool-status");
526
+ expect(el.textContent).toContain("getWeather");
527
+ expect(el.textContent).toContain("Paris");
528
+ expect(el.textContent).toContain("celsius");
529
+ expect(el.textContent).toMatch(/INPROGRESS/);
530
+ });
531
+
532
+ await agent.emit({
533
+ type: EventType.TOOL_CALL_RESULT,
534
+ toolCallId,
535
+ messageId: `${messageId}_result`,
536
+ content: JSON.stringify({ temperature: 21, unit: "celsius" }),
537
+ } as BaseEvent);
538
+
539
+ await waitFor(() => {
540
+ const el = screen.getByTestId("tool-status");
541
+ expect(el.textContent).toMatch(/COMPLETE/);
542
+ expect(el.textContent).toContain("temperature");
543
+ expect(el.textContent).toContain("21");
544
+ });
545
+
546
+ await agent.emit({
547
+ type: EventType.RUN_FINISHED,
548
+ } as BaseEvent);
549
+ await agent.complete();
550
+ });
551
+ });
552
+
553
+ describe("Executing State Transitions", () => {
554
+ it("should show Executing status while tool handler is running", async () => {
555
+ const agent = new MockStepwiseAgent();
556
+ let resolveHandler: (() => void) | undefined;
557
+
558
+ const ToolWithDeferredHandler = defineComponent({
559
+ setup() {
560
+ const tool: VueFrontendTool<{ value: string }> = {
561
+ name: "slowTool",
562
+ parameters: z.object({ value: z.string() }),
563
+ handler: async () =>
564
+ new Promise((resolve) => {
565
+ resolveHandler = () => resolve({ result: "done" });
566
+ }),
567
+ render: SlowToolStatusRenderer,
568
+ };
569
+
570
+ useFrontendTool(tool);
571
+ return {};
572
+ },
573
+ template: `<div />`,
574
+ });
575
+
576
+ renderChatHarness({
577
+ agent,
578
+ registrar: ToolWithDeferredHandler,
579
+ });
580
+
581
+ await submitMessage("Run slow tool");
582
+ await waitFor(() => {
583
+ expect(screen.getByText("Run slow tool")).toBeDefined();
584
+ });
585
+
586
+ const messageId = "m_exec";
587
+ const toolCallId = "tc_exec";
588
+
589
+ await agent.emit({
590
+ type: EventType.RUN_STARTED,
591
+ } as BaseEvent);
592
+ await agent.emit({
593
+ type: EventType.TOOL_CALL_CHUNK,
594
+ toolCallId,
595
+ toolCallName: "slowTool",
596
+ parentMessageId: messageId,
597
+ delta: '{"value":"test"}',
598
+ } as BaseEvent);
599
+
600
+ await waitFor(() => {
601
+ const status = screen.getByTestId("slow-tool-status");
602
+ expect(status.textContent).toMatch(/Status: inProgress/i);
603
+ expect(status.textContent).toMatch(/Value: test/);
604
+ });
605
+
606
+ await agent.emit({
607
+ type: EventType.RUN_FINISHED,
608
+ } as BaseEvent);
609
+ await agent.complete();
610
+
611
+ await waitFor(() => {
612
+ const status = screen.getByTestId("slow-tool-status");
613
+ expect(status.textContent).toMatch(/Status: executing/i);
614
+ expect(resolveHandler).toBeTruthy();
615
+ });
616
+
617
+ resolveHandler?.();
618
+
619
+ await waitFor(() => {
620
+ const status = screen.getByTestId("slow-tool-status");
621
+ expect(status.textContent).toMatch(/Status: complete/i);
622
+ expect(status.textContent).toMatch(/Result: Complete/);
623
+ });
624
+ });
625
+ });
626
+
627
+ describe("Multiple Tool Calls in Same Message", () => {
628
+ it("should render multiple tools independently with their own status", async () => {
629
+ const agent = new MockStepwiseAgent();
630
+ renderChatHarness({
631
+ agent,
632
+ frontendTools: [
633
+ {
634
+ name: "tool1",
635
+ parameters: z.object({ id: z.string() }),
636
+ render: Tool1Renderer,
637
+ },
638
+ {
639
+ name: "tool2",
640
+ parameters: z.object({ id: z.string() }),
641
+ render: Tool2Renderer,
642
+ },
643
+ ],
644
+ });
645
+
646
+ await submitMessage("Multiple tools");
647
+ await waitFor(() => {
648
+ expect(screen.getByText("Multiple tools")).toBeDefined();
649
+ });
650
+
651
+ const messageId = "m_multi";
652
+ const toolCallId1 = "tc_1";
653
+ const toolCallId2 = "tc_2";
654
+ const toolCallId3 = "tc_3";
655
+
656
+ await agent.emit({
657
+ type: EventType.RUN_STARTED,
658
+ } as BaseEvent);
659
+ await agent.emit({
660
+ type: EventType.TOOL_CALL_CHUNK,
661
+ toolCallId: toolCallId1,
662
+ toolCallName: "tool1",
663
+ parentMessageId: messageId,
664
+ delta: '{"id":"first"}',
665
+ } as BaseEvent);
666
+ await agent.emit({
667
+ type: EventType.TOOL_CALL_CHUNK,
668
+ toolCallId: toolCallId2,
669
+ toolCallName: "tool2",
670
+ parentMessageId: messageId,
671
+ delta: '{"id":"second"}',
672
+ } as BaseEvent);
673
+ await agent.emit({
674
+ type: EventType.TOOL_CALL_CHUNK,
675
+ toolCallId: toolCallId3,
676
+ toolCallName: "tool1",
677
+ parentMessageId: messageId,
678
+ delta: '{"id":"third"}',
679
+ } as BaseEvent);
680
+
681
+ await waitFor(() => {
682
+ expect(screen.getByTestId("tool1-first")).toBeDefined();
683
+ expect(screen.getByTestId("tool2-second")).toBeDefined();
684
+ expect(screen.getByTestId("tool1-third")).toBeDefined();
685
+ });
686
+
687
+ await agent.emit({
688
+ type: EventType.TOOL_CALL_RESULT,
689
+ toolCallId: toolCallId2,
690
+ messageId: `${messageId}_r2`,
691
+ content: JSON.stringify({ result: "B" }),
692
+ } as BaseEvent);
693
+
694
+ await waitFor(() => {
695
+ expect(screen.getByTestId("tool2-second").textContent).toContain("B");
696
+ });
697
+
698
+ await agent.emit({
699
+ type: EventType.TOOL_CALL_RESULT,
700
+ toolCallId: toolCallId1,
701
+ messageId: `${messageId}_r1`,
702
+ content: JSON.stringify({ result: "A" }),
703
+ } as BaseEvent);
704
+ await agent.emit({
705
+ type: EventType.TOOL_CALL_RESULT,
706
+ toolCallId: toolCallId3,
707
+ messageId: `${messageId}_r3`,
708
+ content: JSON.stringify({ result: "C" }),
709
+ } as BaseEvent);
710
+
711
+ await waitFor(() => {
712
+ expect(screen.getByTestId("tool1-first").textContent).toContain("A");
713
+ expect(screen.getByTestId("tool2-second").textContent).toContain("B");
714
+ expect(screen.getByTestId("tool1-third").textContent).toContain("C");
715
+ });
716
+
717
+ await agent.emit({
718
+ type: EventType.RUN_FINISHED,
719
+ } as BaseEvent);
720
+ await agent.complete();
721
+ });
722
+ });
723
+
724
+ describe("Partial Args Accumulation", () => {
725
+ it("should properly show InProgress status with accumulating partial args", async () => {
726
+ const agent = new MockStepwiseAgent();
727
+ renderChatHarness({
728
+ agent,
729
+ frontendTools: [
730
+ {
731
+ name: "complexTool",
732
+ parameters: z.object({
733
+ name: z.string().optional(),
734
+ age: z.number().optional(),
735
+ city: z.string().optional(),
736
+ }),
737
+ render: ComplexToolRenderer,
738
+ },
739
+ ],
740
+ });
741
+
742
+ await submitMessage("Complex tool test");
743
+ await waitFor(() => {
744
+ expect(screen.getByText("Complex tool test")).toBeDefined();
745
+ });
746
+
747
+ const messageId = "m_partial";
748
+ const toolCallId = "tc_partial";
749
+
750
+ await agent.emit({
751
+ type: EventType.RUN_STARTED,
752
+ } as BaseEvent);
753
+ await agent.emit({
754
+ type: EventType.TOOL_CALL_CHUNK,
755
+ toolCallId,
756
+ toolCallName: "complexTool",
757
+ parentMessageId: messageId,
758
+ delta: '{"name":"',
759
+ } as BaseEvent);
760
+
761
+ await waitFor(() => {
762
+ expect(screen.getByTestId("complex-tool")).toBeDefined();
763
+ });
764
+
765
+ await agent.emit({
766
+ type: EventType.TOOL_CALL_CHUNK,
767
+ toolCallId,
768
+ parentMessageId: messageId,
769
+ delta: 'Alice"',
770
+ } as BaseEvent);
771
+
772
+ await waitFor(() => {
773
+ const tool = screen.getByTestId("complex-tool");
774
+ expect(tool.textContent).toContain("Name: Alice");
775
+ expect(tool.textContent).toContain("Age: pending");
776
+ });
777
+
778
+ await agent.emit({
779
+ type: EventType.TOOL_CALL_CHUNK,
780
+ toolCallId,
781
+ parentMessageId: messageId,
782
+ delta: ',"age":30',
783
+ } as BaseEvent);
784
+
785
+ await waitFor(() => {
786
+ const tool = screen.getByTestId("complex-tool");
787
+ expect(tool.textContent).toContain("Age: 30");
788
+ expect(tool.textContent).toContain("City: pending");
789
+ });
790
+
791
+ await agent.emit({
792
+ type: EventType.TOOL_CALL_CHUNK,
793
+ toolCallId,
794
+ parentMessageId: messageId,
795
+ delta: ',"city":"Paris"}',
796
+ } as BaseEvent);
797
+
798
+ await waitFor(() => {
799
+ const tool = screen.getByTestId("complex-tool");
800
+ expect(tool.textContent).toContain("City: Paris");
801
+ expect(tool.textContent).toMatch(/Status: (complete|inProgress)/i);
802
+ });
803
+
804
+ await agent.emit({
805
+ type: EventType.RUN_FINISHED,
806
+ } as BaseEvent);
807
+ await agent.complete();
808
+ });
809
+ });
810
+
811
+ describe("toolCallId parity for registered renderers", () => {
812
+ const ToolCallIdStatusRenderer = defineComponent({
813
+ props: {
814
+ name: { type: String, required: true },
815
+ toolCallId: { type: String, required: true },
816
+ status: { type: String, required: true },
817
+ args: {
818
+ type: Object as PropType<Record<string, unknown>>,
819
+ required: true,
820
+ },
821
+ result: { type: null as unknown as PropType<unknown>, required: false },
822
+ },
823
+ setup(props: VueToolCallRendererRenderProps<{ value: string }>) {
824
+ const text = computed(
825
+ () =>
826
+ `id:${props.toolCallId}|status:${props.status}|result:${props.result ? "Complete" : "Pending"}`,
827
+ );
828
+ return { text };
829
+ },
830
+ template: `<div data-testid="tool-call-id-status">{{ text }}</div>`,
831
+ });
832
+
833
+ const WildcardToolCallIdRenderer = defineComponent({
834
+ props: {
835
+ name: { type: String, required: true },
836
+ toolCallId: { type: String, required: true },
837
+ status: { type: String, required: true },
838
+ args: {
839
+ type: Object as PropType<Record<string, unknown>>,
840
+ required: true,
841
+ },
842
+ result: { type: null as unknown as PropType<unknown>, required: false },
843
+ },
844
+ setup(props: VueToolCallRendererRenderProps<unknown>) {
845
+ const text = computed(
846
+ () => `wildcard|id:${props.toolCallId}|name:${props.name}`,
847
+ );
848
+ return { text };
849
+ },
850
+ template: `<div data-testid="wildcard-tool-call-id">{{ text }}</div>`,
851
+ });
852
+
853
+ it("forwards the same toolCallId in inProgress, executing, and complete", async () => {
854
+ const agent = new MockStepwiseAgent();
855
+ let resolveHandler: (() => void) | undefined;
856
+
857
+ const ToolWithDeferredHandler = defineComponent({
858
+ setup() {
859
+ const tool: VueFrontendTool<{ value: string }> = {
860
+ name: "idTrackedTool",
861
+ parameters: z.object({ value: z.string() }),
862
+ handler: async () =>
863
+ new Promise((resolve) => {
864
+ resolveHandler = () => resolve({ result: "done" });
865
+ }),
866
+ render: ToolCallIdStatusRenderer,
867
+ };
868
+
869
+ useFrontendTool(tool);
870
+ return {};
871
+ },
872
+ template: `<div />`,
873
+ });
874
+
875
+ renderChatHarness({
876
+ agent,
877
+ registrar: ToolWithDeferredHandler,
878
+ });
879
+
880
+ await submitMessage("Track tool id");
881
+ await waitFor(() => {
882
+ expect(screen.getByText("Track tool id")).toBeDefined();
883
+ });
884
+
885
+ const messageId = "m_id";
886
+ const toolCallId = "tc_id_parity";
887
+
888
+ await agent.emit({ type: EventType.RUN_STARTED } as BaseEvent);
889
+ await agent.emit({
890
+ type: EventType.TOOL_CALL_CHUNK,
891
+ toolCallId,
892
+ toolCallName: "idTrackedTool",
893
+ parentMessageId: messageId,
894
+ delta: '{"value":"go"}',
895
+ } as BaseEvent);
896
+
897
+ await waitFor(() => {
898
+ const el = screen.getByTestId("tool-call-id-status");
899
+ expect(el.textContent).toMatch(/status:inProgress/);
900
+ expect(el.textContent).toContain(`id:${toolCallId}`);
901
+ });
902
+
903
+ await agent.emit({ type: EventType.RUN_FINISHED } as BaseEvent);
904
+ await agent.complete();
905
+
906
+ await waitFor(() => {
907
+ const el = screen.getByTestId("tool-call-id-status");
908
+ expect(el.textContent).toMatch(/status:executing/);
909
+ expect(el.textContent).toContain(`id:${toolCallId}`);
910
+ expect(resolveHandler).toBeTruthy();
911
+ });
912
+
913
+ resolveHandler?.();
914
+
915
+ await waitFor(() => {
916
+ const el = screen.getByTestId("tool-call-id-status");
917
+ expect(el.textContent).toMatch(/status:complete/);
918
+ expect(el.textContent).toContain(`id:${toolCallId}`);
919
+ expect(el.textContent).toMatch(/result:Complete/);
920
+ });
921
+ });
922
+
923
+ it("passes toolCallId to the wildcard fallback renderer", async () => {
924
+ const toolCallId = "tc_parity_id_wildcard";
925
+ const assistantMessage = createAssistantMessage([
926
+ { id: toolCallId, name: "unknownTool", argsJson: "{}" },
927
+ ]);
928
+
929
+ renderToolCallsHarness({
930
+ message: assistantMessage,
931
+ messages: [],
932
+ frontendTools: [
933
+ {
934
+ name: "*",
935
+ render: WildcardToolCallIdRenderer,
936
+ } as unknown as VueFrontendTool,
937
+ ],
938
+ });
939
+
940
+ await waitFor(() => {
941
+ const el = screen.getByTestId("wildcard-tool-call-id");
942
+ expect(el.textContent).toContain(`id:${toolCallId}`);
943
+ expect(el.textContent).toContain("name:unknownTool");
944
+ });
945
+ });
946
+ });
947
+
948
+ describe("Status Persistence After Agent Stops", () => {
949
+ it("should remain in InProgress status after agent stops if no result", async () => {
950
+ const agent = new MockStepwiseAgent();
951
+ renderChatHarness({
952
+ agent,
953
+ frontendTools: [
954
+ {
955
+ name: "testTool",
956
+ parameters: z.object({ value: z.string() }),
957
+ render: TestToolRenderer,
958
+ },
959
+ ],
960
+ });
961
+
962
+ await submitMessage("Test message");
963
+ await waitFor(() => {
964
+ expect(screen.getByText("Test message")).toBeDefined();
965
+ });
966
+
967
+ const messageId = "msg_status";
968
+ const toolCallId = "tc_status";
969
+
970
+ await agent.emit({
971
+ type: EventType.RUN_STARTED,
972
+ } as BaseEvent);
973
+ await agent.emit({
974
+ type: EventType.TOOL_CALL_CHUNK,
975
+ toolCallId,
976
+ toolCallName: "testTool",
977
+ parentMessageId: messageId,
978
+ delta: '{"value":"test"}',
979
+ } as BaseEvent);
980
+
981
+ await waitFor(() => {
982
+ const statusElement = screen.getByTestId("status");
983
+ expect(statusElement.textContent).toBe("inProgress");
984
+ });
985
+
986
+ await agent.emit({
987
+ type: EventType.RUN_FINISHED,
988
+ } as BaseEvent);
989
+
990
+ await waitFor(() => {
991
+ const statusElement = screen.getByTestId("status");
992
+ expect(statusElement.textContent).toBe("inProgress");
993
+ });
994
+
995
+ const statusElement = screen.getByTestId("status");
996
+ expect(statusElement.textContent).toBe("inProgress");
997
+ expect(statusElement.textContent).not.toBe("complete");
998
+
999
+ await agent.emit({
1000
+ type: EventType.RUN_STARTED,
1001
+ } as BaseEvent);
1002
+ await agent.emit({
1003
+ type: EventType.TOOL_CALL_RESULT,
1004
+ toolCallId,
1005
+ messageId: `${messageId}_result`,
1006
+ content: JSON.stringify({ result: "Tool execution completed" }),
1007
+ } as BaseEvent);
1008
+
1009
+ await waitFor(() => {
1010
+ const statusEl = screen.getByTestId("status");
1011
+ expect(statusEl.textContent).toBe("complete");
1012
+ });
1013
+
1014
+ await agent.emit({
1015
+ type: EventType.RUN_FINISHED,
1016
+ } as BaseEvent);
1017
+ await agent.complete();
1018
+ });
1019
+ });