@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.
- package/CONTRIBUTOR_GUIDE.md +1 -1
- package/PARITY.md +3 -3
- package/dist/hooks/use-copilot-action.d.ts.map +1 -1
- package/dist/hooks/use-frontend-tool.d.ts +1 -1
- package/dist/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/hooks/zod-parameters.d.ts +14 -0
- package/dist/hooks/zod-parameters.d.ts.map +1 -0
- package/dist/index.cjs +1 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +365 -16920
- package/dist/index.mjs.map +1 -1
- package/dist/use-render-activity-message-BZJ33B_r.cjs +113 -0
- package/dist/use-render-activity-message-BZJ33B_r.cjs.map +1 -0
- package/dist/use-render-activity-message-DrR407LQ.js +15901 -0
- package/dist/use-render-activity-message-DrR407LQ.js.map +1 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts +14 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -1
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts +10 -3
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/CopilotKitInspector.vue.d.ts +5 -1
- package/dist/v2/components/CopilotKitInspector.vue.d.ts.map +1 -1
- package/dist/v2/components/InlineFeatureWarning.vue.d.ts.map +1 -1
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts +2 -2
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -1
- package/dist/v2/components/MCPAppsActivityRenderer.d.ts.map +1 -1
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +13 -59
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +3 -11
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +10 -15
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts +14 -130
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts.map +1 -1
- package/dist/v2/components/a2ui/catalog.d.ts.map +1 -1
- package/dist/v2/components/a2ui/utils.d.ts +3 -15
- package/dist/v2/components/a2ui/utils.d.ts.map +1 -1
- package/dist/v2/components/a2ui.d.ts +9 -8
- package/dist/v2/components/a2ui.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChat.vue.d.ts +2 -2
- package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts +4 -8
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +7 -286
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallItem.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts +3 -3
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts +8 -3
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +5 -3
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +5 -3
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +8 -3
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +6 -4
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +6 -4
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotThreadsDrawer.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts +1 -0
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/audioRecorder.d.ts +3 -4
- package/dist/v2/components/chat/audioRecorder.d.ts.map +1 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts +4 -4
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts.map +1 -1
- package/dist/v2/components/chat/forwarded-slots.d.ts +12 -0
- package/dist/v2/components/chat/forwarded-slots.d.ts.map +1 -0
- package/dist/v2/components/chat/index.d.ts +34 -31
- package/dist/v2/components/chat/index.d.ts.map +1 -1
- package/dist/v2/components/chat/inspector-shortcuts.d.ts +2 -1
- package/dist/v2/components/chat/inspector-shortcuts.d.ts.map +1 -1
- package/dist/v2/components/chat/message-feedback.d.ts +38 -49
- package/dist/v2/components/chat/message-feedback.d.ts.map +1 -1
- package/dist/v2/components/chat/tool-call-display-context.d.ts +4 -19
- package/dist/v2/components/chat/tool-call-display-context.d.ts.map +1 -1
- package/dist/v2/components/chat/tool-call-group-parts.d.ts +7 -20
- package/dist/v2/components/chat/tool-call-group-parts.d.ts.map +1 -1
- package/dist/v2/components/chat/turn-work.d.ts +0 -2
- package/dist/v2/components/chat/turn-work.d.ts.map +1 -1
- package/dist/v2/components/chat/types.d.ts +9 -4
- package/dist/v2/components/chat/types.d.ts.map +1 -1
- package/dist/v2/components/chat/use-chat-labels.d.ts +8 -0
- package/dist/v2/components/chat/use-chat-labels.d.ts.map +1 -0
- package/dist/v2/components/chat/use-copy-feedback.d.ts +11 -0
- package/dist/v2/components/chat/use-copy-feedback.d.ts.map +1 -0
- package/dist/v2/components/chat/use-lightbox.d.ts.map +1 -1
- package/dist/v2/components/icons/index.d.ts +968 -1
- package/dist/v2/components/icons/index.d.ts.map +1 -1
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts +1 -1
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts.map +1 -1
- package/dist/v2/hooks/use-agent-context.d.ts +2 -3
- package/dist/v2/hooks/use-agent-context.d.ts.map +1 -1
- package/dist/v2/hooks/use-agent.d.ts +4 -1
- package/dist/v2/hooks/use-agent.d.ts.map +1 -1
- package/dist/v2/hooks/use-attachments.d.ts +7 -0
- package/dist/v2/hooks/use-attachments.d.ts.map +1 -1
- package/dist/v2/hooks/use-capabilities.d.ts.map +1 -1
- package/dist/v2/hooks/use-component.d.ts +1 -0
- package/dist/v2/hooks/use-component.d.ts.map +1 -1
- package/dist/v2/hooks/use-configure-suggestions.d.ts +4 -9
- package/dist/v2/hooks/use-configure-suggestions.d.ts.map +1 -1
- package/dist/v2/hooks/use-default-render-tool.d.ts +2 -7
- package/dist/v2/hooks/use-default-render-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-frontend-tool.d.ts +5 -0
- package/dist/v2/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-human-in-the-loop.d.ts +2 -1
- package/dist/v2/hooks/use-human-in-the-loop.d.ts.map +1 -1
- package/dist/v2/hooks/use-interrupt.d.ts +0 -1
- package/dist/v2/hooks/use-interrupt.d.ts.map +1 -1
- package/dist/v2/hooks/use-keyboard-height.d.ts +1 -1
- package/dist/v2/hooks/use-keyboard-height.d.ts.map +1 -1
- package/dist/v2/hooks/use-pin-to-send.d.ts +4 -12
- package/dist/v2/hooks/use-pin-to-send.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-activity-message.d.ts +13 -9
- package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-custom-messages.d.ts +5 -7
- package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-tool.d.ts +1 -1
- package/dist/v2/hooks/use-render-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-suggestions.d.ts.map +1 -1
- package/dist/v2/hooks/use-threads.d.ts +6 -23
- package/dist/v2/hooks/use-threads.d.ts.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +197 -200
- package/dist/v2/index.mjs.map +1 -1
- package/dist/v2/lib/processPartialHtml.d.ts +1 -2
- package/dist/v2/lib/processPartialHtml.d.ts.map +1 -1
- package/dist/v2/lib/shallow-stable.d.ts.map +1 -1
- package/dist/v2/lib/vue-core.d.ts +33 -19
- package/dist/v2/lib/vue-core.d.ts.map +1 -1
- package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.types.d.ts +9 -129
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts +9 -10
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/chat-configuration-store-key.d.ts +8 -0
- package/dist/v2/providers/chat-configuration-store-key.d.ts.map +1 -0
- package/dist/v2/providers/markdown-renderer.d.ts +4 -2
- package/dist/v2/providers/markdown-renderer.d.ts.map +1 -1
- package/dist/v2/providers/types.d.ts +3 -46
- package/dist/v2/providers/types.d.ts.map +1 -1
- package/dist/v2/providers/use-inspector-thread-override.d.ts +5 -0
- package/dist/v2/providers/use-inspector-thread-override.d.ts.map +1 -1
- package/dist/v2/types/defineToolCallRenderer.d.ts +1 -1
- package/dist/v2/types/defineToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/types/human-in-the-loop.d.ts +8 -29
- package/dist/v2/types/human-in-the-loop.d.ts.map +1 -1
- package/dist/v2/types/interrupt.d.ts +1 -22
- package/dist/v2/types/interrupt.d.ts.map +1 -1
- package/dist/v2/types/vue-activity-message-renderer.d.ts +16 -15
- package/dist/v2/types/vue-activity-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-custom-message-renderer.d.ts +7 -16
- package/dist/v2/types/vue-custom-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-tool-call-renderer.d.ts +16 -35
- package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -1
- package/package.json +12 -13
- package/src/__tests__/build-entries.test.ts +29 -0
- package/src/hooks/__tests__/zod-parameters.test.ts +520 -0
- package/src/hooks/use-copilot-action.ts +2 -1
- package/src/hooks/use-frontend-tool.ts +3 -6
- package/src/hooks/zod-parameters.ts +162 -0
- package/src/v2/__tests__/exports.test.ts +10 -0
- package/src/v2/__tests__/mocks/web-inspector.ts +6 -0
- package/src/v2/__tests__/utils/test-helpers.ts +34 -4
- package/src/v2/components/A2UIMessageRenderer.ts +98 -68
- package/src/v2/components/A2UISurfaceActivityRenderer.vue +68 -103
- package/src/v2/components/CopilotKitInspector.vue +104 -51
- package/src/v2/components/InlineFeatureWarning.vue +20 -21
- package/src/v2/components/LicenseWarningBanner.vue +27 -135
- package/src/v2/components/MCPAppsActivityRenderer.ts +75 -201
- package/src/v2/components/OpenGenerativeUIRenderer.ts +122 -446
- package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +171 -8
- package/src/v2/components/__tests__/CopilotKitInspector.test.ts +42 -0
- package/src/v2/components/__tests__/LicenseWarningBanner.test.ts +60 -0
- package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +64 -8
- package/src/v2/components/__tests__/OpenGenerativeUIToolRenderer.test.ts +38 -0
- package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +6 -26
- package/src/v2/components/a2ui/A2UICatalogContext.ts +27 -185
- package/src/v2/components/a2ui/A2UIRecoveryStates.ts +127 -327
- package/src/v2/components/a2ui/catalog.ts +3 -3
- package/src/v2/components/a2ui/utils.ts +13 -65
- package/src/v2/components/a2ui.ts +15 -22
- package/src/v2/components/chat/CopilotChat.vue +121 -498
- package/src/v2/components/chat/CopilotChatAssistantMessage.vue +47 -184
- package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +36 -55
- package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +14 -6
- package/src/v2/components/chat/CopilotChatAudioRecorder.vue +19 -246
- package/src/v2/components/chat/CopilotChatFeedbackCommentPopover.vue +12 -77
- package/src/v2/components/chat/CopilotChatInput.vue +139 -654
- package/src/v2/components/chat/CopilotChatInspectorButton.vue +45 -108
- package/src/v2/components/chat/CopilotChatLightbox.vue +10 -31
- package/src/v2/components/chat/CopilotChatMessageView.vue +96 -274
- package/src/v2/components/chat/CopilotChatReasoningMessage.vue +27 -62
- package/src/v2/components/chat/CopilotChatToolCallGroup.vue +63 -71
- package/src/v2/components/chat/CopilotChatToolCallItem.vue +8 -6
- package/src/v2/components/chat/CopilotChatToolCallsView.vue +31 -32
- package/src/v2/components/chat/CopilotChatUserMessage.vue +24 -112
- package/src/v2/components/chat/CopilotChatView.vue +123 -161
- package/src/v2/components/chat/CopilotChatWorkSummary.vue +26 -36
- package/src/v2/components/chat/CopilotModalHeader.vue +11 -23
- package/src/v2/components/chat/CopilotPopup.vue +23 -25
- package/src/v2/components/chat/CopilotPopupView.vue +10 -39
- package/src/v2/components/chat/CopilotPopupViewInternal.vue +49 -185
- package/src/v2/components/chat/CopilotSidebar.vue +23 -25
- package/src/v2/components/chat/CopilotSidebarView.vue +10 -39
- package/src/v2/components/chat/CopilotSidebarViewInternal.vue +56 -100
- package/src/v2/components/chat/CopilotThreadsDrawer.vue +43 -105
- package/src/v2/components/chat/StreamingMarkdownDefault.vue +15 -28
- package/src/v2/components/chat/__tests__/CopilotChat.labels.test.ts +19 -4
- package/src/v2/components/chat/__tests__/CopilotChat.test.ts +12 -10
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.ts +26 -9
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.learningFeedback.test.ts +5 -5
- package/src/v2/components/chat/__tests__/CopilotChatAttachmentQueue.test.ts +28 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +132 -1
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.ts +247 -403
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.toolCallDisplay.test.ts +1 -99
- package/src/v2/components/chat/__tests__/CopilotChatView.pinToSend.test.ts +43 -1
- package/src/v2/components/chat/__tests__/CopilotPopup.test.ts +90 -1
- package/src/v2/components/chat/__tests__/CopilotPopupView.test.ts +19 -0
- package/src/v2/components/chat/__tests__/CopilotSidebar.test.ts +90 -1
- package/src/v2/components/chat/__tests__/CopilotSidebarView.position.test.ts +32 -8
- package/src/v2/components/chat/__tests__/CopilotSidebarView.test.ts +2 -1
- package/src/v2/components/chat/__tests__/StreamingMarkdownDefault.test.ts +54 -0
- package/src/v2/components/chat/audioRecorder.ts +4 -7
- package/src/v2/components/chat/copilotChatToolCallItemRender.ts +25 -90
- package/src/v2/components/chat/forwarded-slots.ts +17 -0
- package/src/v2/components/chat/index.ts +0 -1
- package/src/v2/components/chat/inspector-shortcuts.ts +10 -16
- package/src/v2/components/chat/message-feedback.ts +92 -195
- package/src/v2/components/chat/tool-call-display-context.ts +6 -22
- package/src/v2/components/chat/tool-call-group-parts.ts +47 -108
- package/src/v2/components/chat/turn-work.ts +0 -9
- package/src/v2/components/chat/types.ts +12 -4
- package/src/v2/components/chat/use-chat-labels.ts +16 -0
- package/src/v2/components/chat/use-copy-feedback.ts +21 -0
- package/src/v2/components/chat/use-lightbox.ts +15 -33
- package/src/v2/components/icons/__tests__/icons.test.ts +72 -68
- package/src/v2/components/icons/index.ts +109 -27
- package/src/v2/hooks/__tests__/use-agent-error-state.test.ts +5 -3
- package/src/v2/hooks/__tests__/use-agent-stability.test.ts +25 -4
- package/src/v2/hooks/__tests__/use-agent-throttle.test.ts +5 -1
- package/src/v2/hooks/__tests__/use-agent.test.ts +6 -3
- package/src/v2/hooks/__tests__/use-component.test.ts +21 -0
- package/src/v2/hooks/__tests__/use-configure-suggestions.test.ts +30 -1
- package/src/v2/hooks/__tests__/use-default-render-tool.test.ts +10 -10
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +66 -1
- package/src/v2/hooks/__tests__/use-human-in-the-loop.e2e.test.ts +6 -1
- package/src/v2/hooks/__tests__/use-human-in-the-loop.test.ts +187 -12
- package/src/v2/hooks/__tests__/use-interrupt.test.ts +97 -0
- package/src/v2/hooks/__tests__/use-render-activity-message.test.ts +106 -0
- package/src/v2/hooks/__tests__/use-render-tool.test.ts +3 -6
- package/src/v2/hooks/__tests__/use-threads.test.ts +48 -6
- package/src/v2/hooks/__tests__/zod-regression.test.ts +5 -4
- package/src/v2/hooks/use-agent-context.ts +4 -10
- package/src/v2/hooks/use-agent.ts +86 -290
- package/src/v2/hooks/use-attachments.ts +48 -168
- package/src/v2/hooks/use-capabilities.ts +2 -7
- package/src/v2/hooks/use-component.ts +7 -4
- package/src/v2/hooks/use-configure-suggestions.ts +29 -220
- package/src/v2/hooks/use-default-render-tool.ts +31 -152
- package/src/v2/hooks/use-frontend-tool.ts +15 -25
- package/src/v2/hooks/use-human-in-the-loop.ts +11 -80
- package/src/v2/hooks/use-interrupt.ts +29 -308
- package/src/v2/hooks/use-keyboard-height.ts +17 -40
- package/src/v2/hooks/use-pin-to-send.ts +15 -99
- package/src/v2/hooks/use-render-activity-message.ts +35 -57
- package/src/v2/hooks/use-render-custom-messages.ts +24 -88
- package/src/v2/hooks/use-render-tool.ts +2 -4
- package/src/v2/hooks/use-suggestions.ts +17 -36
- package/src/v2/hooks/use-threads.ts +49 -288
- package/src/v2/lib/__tests__/shallow-stable.test.ts +54 -0
- package/src/v2/lib/__tests__/vue-core-renderers.test.ts +42 -0
- package/src/v2/lib/processPartialHtml.ts +6 -21
- package/src/v2/lib/shallow-stable.ts +2 -16
- package/src/v2/lib/vue-core.ts +90 -85
- package/src/v2/providers/CopilotChatConfigurationProvider.vue +48 -186
- package/src/v2/providers/CopilotKitProvider.types.ts +12 -132
- package/src/v2/providers/CopilotKitProvider.vue +291 -641
- package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.test.ts +22 -2
- package/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.ts +38 -2
- package/src/v2/providers/__tests__/CopilotKitProvider.config.test.ts +124 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.headersAtSendTime.test.ts +3 -3
- package/src/v2/providers/__tests__/CopilotKitProvider.learning.test.ts +3 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.sandboxFunctions.test.ts +4 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +88 -28
- package/src/v2/providers/chat-configuration-store-key.ts +9 -0
- package/src/v2/providers/markdown-renderer.ts +8 -2
- package/src/v2/providers/types.ts +3 -49
- package/src/v2/providers/use-inspector-thread-override.ts +22 -80
- package/src/v2/types/__tests__/defineToolCallRenderer.test.ts +28 -33
- package/src/v2/types/defineToolCallRenderer.ts +7 -6
- package/src/v2/types/human-in-the-loop.ts +8 -32
- package/src/v2/types/interrupt.ts +7 -31
- package/src/v2/types/vue-activity-message-renderer.ts +24 -15
- package/src/v2/types/vue-custom-message-renderer.ts +12 -16
- package/src/v2/types/vue-tool-call-renderer.ts +23 -38
- package/tsconfig.json +0 -1
- package/vite.config.ts +8 -5
- package/vitest.config.ts +12 -7
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts +0 -9
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts.map +0 -1
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts +0 -3
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts.map +0 -1
- package/dist/v2/components/chat/tool-call-layout.d.ts +0 -115
- package/dist/v2/components/chat/tool-call-layout.d.ts.map +0 -1
- package/dist/v2/lib/is-mobile-viewport.d.ts +0 -15
- package/dist/v2/lib/is-mobile-viewport.d.ts.map +0 -1
- package/dist/v2/lib/message-feedback.d.ts +0 -33
- package/dist/v2/lib/message-feedback.d.ts.map +0 -1
- package/dist/v2/lib/transcription-client.d.ts +0 -19
- package/dist/v2/lib/transcription-client.d.ts.map +0 -1
- package/src/v2/components/__tests__/A2UICatalogContext.test.ts +0 -63
- package/src/v2/components/a2ui/__tests__/A2UIRecoveryStates.test.ts +0 -175
- package/src/v2/components/chat/BasicMarkdown.vue +0 -160
- package/src/v2/components/chat/__tests__/BasicMarkdown.test.ts +0 -69
- package/src/v2/components/chat/__tests__/normalize-auto-scroll.test.ts +0 -39
- package/src/v2/components/chat/normalize-auto-scroll.ts +0 -17
- package/src/v2/components/chat/tool-call-layout.ts +0 -304
- package/src/v2/lib/__tests__/is-mobile-viewport.test.ts +0 -48
- package/src/v2/lib/__tests__/message-feedback.test.ts +0 -152
- package/src/v2/lib/__tests__/processPartialHtml.test.ts +0 -84
- package/src/v2/lib/__tests__/transcription-client.test.ts +0 -67
- package/src/v2/lib/is-mobile-viewport.ts +0 -23
- package/src/v2/lib/message-feedback.ts +0 -120
- package/src/v2/lib/transcription-client.ts +0 -151
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
defineComponent,
|
|
4
|
+
h,
|
|
5
|
+
onBeforeUnmount,
|
|
6
|
+
ref,
|
|
7
|
+
shallowRef,
|
|
8
|
+
watch,
|
|
9
|
+
} from "vue";
|
|
2
10
|
import type { PropType } from "vue";
|
|
3
11
|
import type { AbstractAgent } from "@ag-ui/client";
|
|
4
12
|
import type { VueActivityMessageRendererProps } from "../types";
|
|
@@ -27,12 +35,8 @@ export type {
|
|
|
27
35
|
} from "@copilotkit/mcp-apps-renderer/activity";
|
|
28
36
|
|
|
29
37
|
import type { MCPAppsActivityContent } from "@copilotkit/mcp-apps-renderer/activity";
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
import type {
|
|
33
|
-
McpAppSession,
|
|
34
|
-
FetchedResource,
|
|
35
|
-
} from "@copilotkit/mcp-apps-renderer";
|
|
38
|
+
import { ɵMcpAppHost } from "@copilotkit/mcp-apps-renderer/activity";
|
|
39
|
+
import type { ɵMcpAppHostState } from "@copilotkit/mcp-apps-renderer/activity";
|
|
36
40
|
|
|
37
41
|
/**
|
|
38
42
|
* MCP Apps Extension Activity Renderer
|
|
@@ -77,213 +81,82 @@ export const MCPAppsActivityRenderer = defineComponent({
|
|
|
77
81
|
setup(props) {
|
|
78
82
|
const { copilotkit } = useCopilotKit();
|
|
79
83
|
const containerRef = ref<HTMLDivElement | null>(null);
|
|
80
|
-
//
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const sessionRef = shallowRef<McpAppSession | null>(null);
|
|
93
|
-
const fetchedResource = shallowRef<FetchedResource | null>(null);
|
|
94
|
-
|
|
95
|
-
// The activity message id. Passed to the session so it self-subscribes to
|
|
96
|
-
// the agent's activity stream and pushes tool input/result itself (this
|
|
97
|
-
// adapter does not forward store-backed activities).
|
|
98
|
-
const messageId = computed(() => props.message?.id);
|
|
84
|
+
// The shared host owns the iframe, its size and its state, and binds the
|
|
85
|
+
// protocol session (loaded lazily); this component only draws the state.
|
|
86
|
+
const app = shallowRef<ɵMcpAppHost | null>(null);
|
|
87
|
+
// Set by the immediate watcher below, before the first render.
|
|
88
|
+
const state = shallowRef<ɵMcpAppHostState>({
|
|
89
|
+
loading: true,
|
|
90
|
+
error: null,
|
|
91
|
+
contentError: null,
|
|
92
|
+
size: {},
|
|
93
|
+
prefersBorder: false,
|
|
94
|
+
});
|
|
95
|
+
let unsubscribe: () => void = () => undefined;
|
|
99
96
|
|
|
100
|
-
//
|
|
101
|
-
// widget identity (resourceUri/serverHash/serverId) or the agent/host/message
|
|
102
|
-
// changes - NOT when tool input/result stream in (those are pushed without
|
|
103
|
-
// recreating the iframe). `flush: "post"` so the container element is mounted
|
|
104
|
-
// when the callback runs.
|
|
97
|
+
// A new host or sandbox setting needs a new host object.
|
|
105
98
|
watch(
|
|
106
|
-
[
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
() => props.content.resourceUri,
|
|
115
|
-
() => props.content.serverHash,
|
|
116
|
-
() => props.content.serverId,
|
|
117
|
-
() => props.allowSameOriginFallback,
|
|
118
|
-
],
|
|
119
|
-
([container, agent], _old, onCleanup) => {
|
|
120
|
-
if (!agent) {
|
|
121
|
-
error.value = new Error("No agent available to fetch resource");
|
|
122
|
-
isLoading.value = false;
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
if (!container) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
let mounted = true;
|
|
130
|
-
isLoading.value = true;
|
|
131
|
-
error.value = null;
|
|
132
|
-
contentError.value = null;
|
|
133
|
-
iframeSize.value = {};
|
|
134
|
-
fetchedResource.value = null;
|
|
135
|
-
|
|
136
|
-
// The host owns the iframe: create + mount it here (bindMcpApp only
|
|
137
|
-
// configures the sandbox contract + talks to it through the bridge).
|
|
138
|
-
const iframe = document.createElement("iframe");
|
|
139
|
-
iframe.style.width = "100%";
|
|
140
|
-
iframe.style.height = "100px";
|
|
141
|
-
iframe.style.border = "none";
|
|
142
|
-
iframe.style.backgroundColor = "transparent";
|
|
143
|
-
iframe.style.display = "block";
|
|
144
|
-
container.appendChild(iframe);
|
|
145
|
-
iframeRef.value = iframe;
|
|
146
|
-
|
|
147
|
-
// Register cleanup BEFORE the async import: if this watcher is
|
|
148
|
-
// invalidated (props change / unmount) while the import is in flight,
|
|
149
|
-
// `mounted` is already false when it resolves, so we never bind.
|
|
150
|
-
onCleanup(() => {
|
|
151
|
-
mounted = false;
|
|
152
|
-
sessionRef.value?.teardown();
|
|
153
|
-
sessionRef.value = null;
|
|
154
|
-
iframe.remove();
|
|
155
|
-
if (iframeRef.value === iframe) {
|
|
156
|
-
iframeRef.value = null;
|
|
157
|
-
}
|
|
99
|
+
[() => copilotkit.value, () => props.allowSameOriginFallback],
|
|
100
|
+
([core, allowSameOriginFallback]) => {
|
|
101
|
+
unsubscribe();
|
|
102
|
+
app.value?.destroy();
|
|
103
|
+
const created = new ɵMcpAppHost({
|
|
104
|
+
host: core,
|
|
105
|
+
sessionOptions: { allowSameOriginFallback },
|
|
106
|
+
importRenderer: () => import("@copilotkit/mcp-apps-renderer"),
|
|
158
107
|
});
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
// behind a dynamic import() means a non-MCP app never pays for it.
|
|
165
|
-
const mod = await import("@copilotkit/mcp-apps-renderer").catch(
|
|
166
|
-
(importErr) => {
|
|
167
|
-
throw new Error(
|
|
168
|
-
"MCP Apps require '@copilotkit/mcp-apps-renderer' and its " +
|
|
169
|
-
"'@modelcontextprotocol/ext-apps' dependency. Reinstall your " +
|
|
170
|
-
"dependencies if this package is missing.",
|
|
171
|
-
{ cause: importErr },
|
|
172
|
-
);
|
|
173
|
-
},
|
|
174
|
-
);
|
|
175
|
-
if (!mounted) return;
|
|
176
|
-
|
|
177
|
-
const session = mod.bindMcpApp({
|
|
178
|
-
iframe,
|
|
179
|
-
getContent: () => props.content,
|
|
180
|
-
getAgent: () => props.agent,
|
|
181
|
-
host: copilotkit.value,
|
|
182
|
-
// Self-driving: the session subscribes to the agent's activity
|
|
183
|
-
// stream (filtered by messageId) and pushes tool input/result to
|
|
184
|
-
// the widget itself, so this adapter does not forward STORE-backed
|
|
185
|
-
// activities. It still calls syncContent for activities rendered
|
|
186
|
-
// from an external messages list (see the seed below).
|
|
187
|
-
messageId: messageId.value,
|
|
188
|
-
options: {
|
|
189
|
-
allowSameOriginFallback: props.allowSameOriginFallback,
|
|
190
|
-
},
|
|
191
|
-
hooks: {
|
|
192
|
-
onResource: (resource) => {
|
|
193
|
-
if (!mounted) return;
|
|
194
|
-
fetchedResource.value = resource;
|
|
195
|
-
isLoading.value = false;
|
|
196
|
-
},
|
|
197
|
-
onSizeChanged: (size) => {
|
|
198
|
-
if (mounted) iframeSize.value = size;
|
|
199
|
-
},
|
|
200
|
-
onContentError: (err) => {
|
|
201
|
-
if (mounted) contentError.value = err;
|
|
202
|
-
},
|
|
203
|
-
onError: (err) => {
|
|
204
|
-
if (!mounted) return;
|
|
205
|
-
error.value = err;
|
|
206
|
-
isLoading.value = false;
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
});
|
|
210
|
-
sessionRef.value = session;
|
|
211
|
-
// Seed the initial content now: the content watcher below does not
|
|
212
|
-
// re-run for unchanged props, so an activity rendered from an
|
|
213
|
-
// EXTERNAL messages list (absent from agent.messages) would never
|
|
214
|
-
// receive its initial tool input/result. Deduped + store precedence
|
|
215
|
-
// make this a no-op for agent-backed activities.
|
|
216
|
-
session.syncContent(props.content);
|
|
217
|
-
} catch (err) {
|
|
218
|
-
console.error("[MCPAppsRenderer] Setup error:", err);
|
|
219
|
-
if (mounted) {
|
|
220
|
-
error.value = err instanceof Error ? err : new Error(String(err));
|
|
221
|
-
isLoading.value = false;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
void setup();
|
|
108
|
+
unsubscribe = created.subscribe(() => {
|
|
109
|
+
state.value = created.getState();
|
|
110
|
+
});
|
|
111
|
+
state.value = created.getState();
|
|
112
|
+
app.value = created;
|
|
227
113
|
},
|
|
228
|
-
{ immediate: true
|
|
114
|
+
{ immediate: true },
|
|
229
115
|
);
|
|
230
|
-
|
|
231
|
-
// Size the iframe when the widget reports a new content size.
|
|
116
|
+
// `flush: "post"` so the container element is mounted when this runs.
|
|
232
117
|
watch(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
118
|
+
[
|
|
119
|
+
app,
|
|
120
|
+
() => props.agent,
|
|
121
|
+
() => props.message?.id,
|
|
122
|
+
() => props.content,
|
|
123
|
+
containerRef,
|
|
124
|
+
],
|
|
125
|
+
([host, agent, messageId, content, container]) => {
|
|
126
|
+
if (!host) return;
|
|
127
|
+
host.setAgent(agent);
|
|
128
|
+
host.setMessageId(messageId);
|
|
129
|
+
host.setContent(content);
|
|
130
|
+
host.setContainer(container);
|
|
245
131
|
},
|
|
246
|
-
{
|
|
132
|
+
{ immediate: true, flush: "post" },
|
|
247
133
|
);
|
|
134
|
+
onBeforeUnmount(() => {
|
|
135
|
+
unsubscribe();
|
|
136
|
+
app.value?.destroy();
|
|
137
|
+
});
|
|
248
138
|
|
|
249
|
-
//
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
sessionRef.value?.syncContent(props.content);
|
|
259
|
-
},
|
|
260
|
-
{ deep: true },
|
|
139
|
+
// prefersBorder: true = border and background; otherwise none.
|
|
140
|
+
const borderStyle = computed(() =>
|
|
141
|
+
state.value.prefersBorder
|
|
142
|
+
? {
|
|
143
|
+
borderRadius: "8px",
|
|
144
|
+
backgroundColor: "#f9f9f9",
|
|
145
|
+
border: "1px solid #e0e0e0",
|
|
146
|
+
}
|
|
147
|
+
: {},
|
|
261
148
|
);
|
|
262
149
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
const prefersBorder = fetchedResource.value?._meta?.ui?.prefersBorder;
|
|
268
|
-
if (prefersBorder !== true) return {};
|
|
269
|
-
return {
|
|
270
|
-
borderRadius: "8px",
|
|
271
|
-
backgroundColor: "#f9f9f9",
|
|
272
|
-
border: "1px solid #e0e0e0",
|
|
273
|
-
};
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
return () =>
|
|
277
|
-
h(
|
|
150
|
+
return () => {
|
|
151
|
+
const { loading, error, contentError, size } = state.value;
|
|
152
|
+
const shownError = error ?? contentError;
|
|
153
|
+
return h(
|
|
278
154
|
"div",
|
|
279
155
|
{
|
|
280
156
|
ref: containerRef,
|
|
281
157
|
style: {
|
|
282
158
|
width: "100%",
|
|
283
|
-
height:
|
|
284
|
-
iframeSize.value.height !== undefined
|
|
285
|
-
? `${iframeSize.value.height}px`
|
|
286
|
-
: "auto",
|
|
159
|
+
height: size.height !== undefined ? `${size.height}px` : "auto",
|
|
287
160
|
minHeight: "100px",
|
|
288
161
|
overflow: "hidden",
|
|
289
162
|
position: "relative",
|
|
@@ -291,22 +164,23 @@ export const MCPAppsActivityRenderer = defineComponent({
|
|
|
291
164
|
},
|
|
292
165
|
},
|
|
293
166
|
[
|
|
294
|
-
|
|
167
|
+
loading
|
|
295
168
|
? h(
|
|
296
169
|
"div",
|
|
297
170
|
{ style: { padding: "1rem", color: "#666" } },
|
|
298
171
|
"Loading...",
|
|
299
172
|
)
|
|
300
173
|
: null,
|
|
301
|
-
|
|
174
|
+
shownError
|
|
302
175
|
? h(
|
|
303
176
|
"div",
|
|
304
177
|
{ style: { color: "red", padding: "1rem" } },
|
|
305
|
-
`Error: ${
|
|
178
|
+
`Error: ${shownError}`,
|
|
306
179
|
)
|
|
307
180
|
: null,
|
|
308
181
|
],
|
|
309
182
|
);
|
|
183
|
+
};
|
|
310
184
|
},
|
|
311
185
|
});
|
|
312
186
|
|